2013-03-19
| 00:00 | yogthos | (pdf [{} |
| 00:00 | yogthos | [:table [[:cell {:align :right} "foo foo foo"]]] |
| 00:00 | yogthos | "bar"] |
| 00:00 | yogthos | "output.pdf") |
| 00:00 | yogthos | Frozenlock: so this should actually work |
| 00:01 | yogthos | Frozenlock: started digging and seems like I got it implemented already :) |
| 00:02 | Frozenlock | It does! |
| 00:02 | Frozenlock | Thank you very much indeed! |
| 00:02 | yogthos | Frozenlock: no prob, I'll update the docs :) |
| 00:02 | yogthos | kinda sad even I forgot it's there |
| 00:08 | Frozenlock | I wonder if dynamic variables could be useful in this case. (binding [*align* :right] ....) |
| 00:20 | yogthos | Frozenlock: you could yeah |
| 00:20 | yogthos | Frozenlock: another option is to use the templates |
| 00:21 | yogthos | Frozenlock: I could add a text-align to the table, so you don't have to do it per cell as well |
| 00:25 | yogthos | Frozenlock: you can do stuff like this as well |
| 00:25 | yogthos | (def items [{:item "foo"} {:item "bar"} {:item "baz"}]) |
| 00:25 | yogthos | (pdf [{} [:table ((template [:cell {:align :right} $item]) items)]] "output.pdf") |
| 01:01 | tieTYT2 | does clojure come with a library for using an http client to login to pages and browse pages, etc? or should I use java's http-client? |
| 01:03 | Hendekagon | tieTYT2 - check out Aleph |
| 01:04 | tieTYT2 | cool thanks |
| 01:04 | yogthos | tieTYT2: https://github.com/dakrone/clj-http |
| 01:05 | yogthos | tieTYT2: this is an excellent resource site btw http://clojure-doc.org/ |
| 01:06 | yogthos | tieTYT2: for example they have a nice up to date common libraries list http://clojure-doc.org/articles/content.html#clojure_library_directory |
| 01:06 | yogthos | err this link http://clojure-doc.org/articles/ecosystem/libraries_directory.html |
| 01:07 | aiba | is it a bug in clojurescript that (= (hash [1 2 3]) (hash [1 2 [3]])) ? |
| 01:07 | Hendekagon | tieTYT2 - https://github.com/ztellman/aleph#http-client |
| 01:07 | amalloy | aiba: it is never a bug for two different objects to hash to the same thing |
| 01:08 | amalloy | might have a negative impact on performance, but will never break correctness |
| 01:08 | aiba | oh right, thanks, i was being stupid |
| 01:08 | tieTYT2 | i'm looking for an example that submits forms |
| 01:08 | tieTYT2 | it looks like clj-http has an example |
| 01:08 | tieTYT2 | so i'll probably use that one |
| 01:09 | tieTYT2 | yogthos: i'm reading stuff on that site right now :) |
| 01:10 | tieTYT2 | that's a useful list of things |
| 01:11 | mrowe | fwiw, I have found http.async.client much nicer to work with than clj-http |
| 01:11 | tieTYT2 | this list is pretty impressive considering you can just fall back on the java ecosystem if you want |
| 01:14 | yogthos | tieTYT2: yeah I find there's lots of nice libraries out there now |
| 01:34 | tieTYT2 | yogthos|away: do you make light table? |
| 01:54 | tomoj | hmm, maybe use @ in bindings to indicate that the value is expected to be lazy, and to set up a promise for recursive definitions? |
| 01:55 | tomoj | while @ in the binding exprs indicates what you would normally expect, deref and the remaining bindings happen after deref |
| 01:56 | tomoj | (let [@s (cons x (lazy-seq s))] s) |
| 01:58 | amalloy | tomoj: and what would that macroexpand to? |
| 01:58 | tomoj | https://www.refheap.com/paste/c2cf06c771acb2f82077be63e |
| 01:58 | tomoj | that was my attempt, I dunno how it generalizes |
| 02:04 | tomoj | https://www.refheap.com/paste/74e6c066da01f59bab09be05f |
| 02:04 | tomoj | :/ |
| 02:12 | tomoj | er, [:input {:type :text :value (switch "" input)}] |
| 02:22 | egghead | hmm |
| 02:23 | NeedMoreDesu | It seems nrepl.el blocks my attempts to use Thread$UncaughtExceptionHandler. Any suggestions about how can I make stacktraces on thread exception? (print-stacktrace thread) is fine too. |
| 02:23 | egghead | playing with pedestal, hello world app has 1.5mb deps? |
| 02:30 | tieTYT2 | NeedMoreDesu: so weird, I just read an article about this today |
| 02:30 | tieTYT2 | jayfields wrote it |
| 02:31 | tieTYT2 | http://blog.jayfields.com/2011/01/clojure-using-java-inner-classes.html |
| 02:31 | tieTYT2 | now I barely know clojure so I don't even know if this would help you |
| 02:31 | tieTYT2 | keep that in mind, but I hope it helps |
| 02:33 | NeedMoreDesu | tieTYT2: I've read those article. But http://www.everfall.com/paste/id.php?g8m0uog0kp1d works only in pure lein repl, dont works in nrepl.el session. |
| 03:26 | NeedMoreDesu | Ahh, in the end i've just wrapped inner function in try-catch, as I was suggested in the very beginning. |
| 04:06 | drorbemet | |
| 05:19 | tomoj | CPU% 2970; r/fold :D |
| 05:19 | clgv | tomoj: 32 cores? |
| 05:20 | tomoj | yeah |
| 05:22 | clgv | tomoj: which problem domain? big data? |
| 05:24 | tomoj | I'm just poking at google's ngrams |
| 05:40 | ejackson | tomoj: that's cool ! |
| 05:42 | talios | 'lo kittylyst |
| 05:42 | talios | Didnt know you were a clojurian :) |
| 05:43 | kittylyst | Hi talios. Yes, when I get to do any coding these days. There are a couple of chapters on it in my book :) |
| 05:43 | talios | Nice |
| 05:43 | talios | I think I saw a post from you the other day on the clojure list about it not working on JDK8? |
| 05:47 | linq | hello guys. I instal leiningen, sublime text2 with sublimeRepl. In sublimeRepl settings i edit "path to lein". So, repl works, but when i write "(use 'pl.danieljanus.tagsoup)", i had java.io.FileNotFoundException: Could not locate pl/danieljanus/tagsoup__init.class or pl/danieljanus/tagsoup.clj on classpath: (NO_SOURCE_FILE:0) |
| 06:08 | noidi | linq, and you've added tagsoup as a dependency in project.clj? |
| 06:19 | florianover | whats the most idiomatic way to get an entry from a collection of maps where a value of a key has a value of ["name1", "name2", "name3"] ? |
| 06:20 | hyPiRion | florianover: Do you mean like ##(get-in {:name1 {:name2 {:name3 1034}}} [:name1 :name2 :name3]) ? |
| 06:20 | lazybot | ⇒ 1034 |
| 06:21 | hyPiRion | Oh, where you have a value, and want a key. |
| 06:21 | hyPiRion | I need to learn how to read. |
| 06:21 | florianover | no. you have the collection [{:name "Bla"}{:name "Foo"}{:name "boo"}] |
| 06:22 | hyPiRion | Okay, and you want ["Bla", "Foo", "boo"]? |
| 06:22 | florianover | and you have a collection of names you are interested in ["Bar" "boo"] |
| 06:22 | florianover | and i want the map where :name "boo" |
| 06:23 | hyPiRion | ,(filter #(-> % :name #{"Bar" "boo"}) [{:name "Bla"}{:name "Foo"}{:name "boo"}] |
| 06:23 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 06:23 | hyPiRion | ,(filter #(-> % :name #{"Bar" "boo"}) [{:name "Bla"}{:name "Foo"}{:name "boo"}]) |
| 06:23 | clojurebot | ({:name "boo"}) |
| 06:24 | florianover | will try |
| 06:24 | florianover | thanks |
| 06:29 | drorbemet | |
| 06:38 | drorbemet | Hi, what is a better practice in Clojure? : |
| 06:38 | drorbemet | (def function-name (fn [arguments] (function body ...))) or |
| 06:38 | drorbemet | (defn function-name [arguments] (function body ...)) |
| 06:44 | hyPiRion | drorbemet: usually defn |
| 06:46 | drorbemet | hyPiRion: so there arn't any complications down the road when a project gets bigger ... fine, thanks |
| 06:55 | thm_prover | is there anyway to get OpenGL to work with clojure on macosx 10.8, given that lwjgl requires jawt, which is not availble in java 7? (and apple only has java 7 for 10.8) |
| 07:38 | NeedMoreDesu | Is there something like (exception? arg) ? |
| 07:39 | hyPiRion | NeedMoreDesu: (instance? Exception arg) |
| 07:40 | NeedMoreDesu | hyPiRion: thanks. |
| 07:41 | hyPiRion | ,(instance? Exception (RuntimeException.)) |
| 07:41 | clojurebot | true |
| 08:14 | abp | Hi, any pointers on what's the best way to implement scheduled mailing in a Clojure web app? |
| 08:22 | vagmi | abp: You might want to look at http://clojurequartz.info/ |
| 08:31 | ejackson | abp: I manually schedule actions using cron calling the web service |
| 08:31 | ejackson | its old skool, but solid. |
| 08:46 | josteink | you -really- appreciate "lein deps" after trying to port code from VS project based on "Nu get" to another |
| 08:46 | josteink | jesus f christ |
| 08:46 | josteink | insane pos |
| 08:51 | wink | really? |
| 08:51 | wink | I only heard about it once, and it was positive |
| 08:52 | josteink | madness |
| 08:52 | josteink | project 1 has lots of codes with lots of third party dependencies. all dependencies are in a file called packages.config |
| 08:53 | josteink | in project 2, I want to copy that code and you'd think I'd just need to shove the packages.config, retrigger a fetch and be done |
| 08:53 | josteink | noooo |
| 08:53 | josteink | you have to parse the packages.config XML into a powershell script which is run line by line, adding each dependency to the project, one by one |
| 08:53 | josteink | and THEN you think you are done |
| 08:54 | josteink | but no, because the packages are just DLed in a repo outside the project, where you have to one and one go and add the f---ing DLLs to your new project |
| 08:54 | josteink | it would be easier to never use the tool in the first place |
| 08:54 | jstew | Anyone who's gone to clojure from an object oriented language... How long did it take you to "get it"? I've been doing koans and problems on and off for a month or so, and I just feel like I can't grasp it. (IOW, clojure makes me feel dumb). |
| 08:56 | ejackson | jstew: clojure makes everybody feel dumb at first. So its just like git, only with git it never stops. Keep cracking at it! |
| 08:57 | john2x | ah shucks did I miss the discussion about pedestal? |
| 08:58 | jstew | Haha... Yes, git still surprises me from time to time. |
| 08:59 | Pupnik- | you never really know a language tillyou have a decent project (or several) under your belt |
| 09:00 | jstew | Pupnik-: This is true. The basics of fp, to me, seem harder to grasp than learning an imperitive language like C |
| 09:00 | Pupnik- | maybe you dont remember how difficult it was to learn C to start with |
| 09:00 | ejackson | jstew: the thing that helped me to understand is that in OOP when you call a method the object changes. In FP when you call a function you just get back another copy of the object with the change made. |
| 09:01 | jstew | I suppose I'll just keep at it and grind my way through the tough parts. And I agree, it was a long, long time ago I learned C, so my memory may be deleting a bunch. |
| 09:06 | Pupnik- | if you have been doing problems etc for a while |
| 09:06 | Pupnik- | do a small project |
| 09:07 | Pupnik- | maybe one that lends itself to functional style |
| 09:26 | gmailer | Hi guys, i'm working on a compojure app, and i'm finding myself passing the req map around a lot, i've been looking into dynamic bindings, and how lib-noir does things... |
| 09:26 | gmailer | Is that sort of approach a good/bad idea? I'm unsure what the general approches are when it comes to information hiding vs code "verbosity" |
| 09:34 | edw | gmailer: Does your code keep and pass the request along only so that code several levels deeper may or may not use it? In that case—and this is a judgement call—I think using a binding probably makes sense. I would consider using the thread local value as an argument to a function and not in the function body itself, so you can still test it. |
| 09:35 | edw | "It" being the function the operates on the thread-local value, that is. |
| 09:40 | gmailer | i'm not quite sure i follow that last bit |
| 09:42 | gmailer | to borrow a lib-noir example: (set-cookie! :name "value") is roughly equivalent to (ring.util.response/set-cookie req :name "value") |
| 10:12 | jcromartie | seriously, XML namespaces... |
| 10:15 | nDuff | jcromartie: What about them? |
| 10:18 | jcromartie | nDuff: can't live with them, can't live without them |
| 10:18 | jcromartie | especially when dealing with outside XML |
| 10:30 | nDuff | jcromartie: I'm much more on the "can't live without them" side of the fence. |
| 10:30 | jcromartie | yes they're immensely useful |
| 10:30 | jcromartie | but clojure.xml throws them out |
| 10:30 | nDuff | Yes. That's my principal source of unhappiness with it, as it happens. |
| 10:39 | jcromartie | wow |
| 10:39 | jcromartie | (fn? a-multifn) ;;=> false |
| 10:39 | jtoy_ | waht exactly does the with-precision argument do? I cant get this number to change: (with-precision 5 112312313123 ) (with-precision 555 112312313123 ) |
| 10:40 | jcromartie | ifn? is what I am looking for, then |
| 10:41 | clgv | jtoy_: afaik it was used for floating point numbers with arbitrary precision |
| 10:41 | nDuff | ,(with-precision 5 (/ 112312313123M 1)) |
| 10:41 | clojurebot | 1.1231E+11M |
| 10:42 | nDuff | jtoy_: ^^ |
| 10:42 | nDuff | jtoy_: Precision isn't involved when _reading_ BigDecimals, just calculating on them. |
| 10:42 | clgv | ah it was the "M" suffix. I just searched for that example^^ |
| 10:43 | clgv | ,(/ 112312313123M 1) |
| 10:43 | clojurebot | 112312313123M |
| 10:43 | gmailer | jcromartie: are there some good high-level alternatives to clojure.xml? I'm about to do some XML parsing and unsure if there's a generally accepted lib to use |
| 10:45 | jtoy_ | so is there a way I can use with-precision to floor decimals to integers? this doesnt work: (with-precision 1 :rounding FLOOR (Math/sqrt 5) ) |
| 10:46 | hyPiRion | Math/floor isn't sufficient? |
| 10:47 | nDuff | jtoy_: It's the wrong tool for the job, but if you _really_ wanted to... |
| 10:47 | nDuff | ,(with-precision 1 :rounding FLOOR (/ (BigDecimal. (Math/sqrt 5)) 1)) |
| 10:47 | clojurebot | 2M |
| 10:47 | jcromartie | gmailer: I have not found one |
| 10:47 | jcromartie | I just wrote my own around the Java DOM API |
| 10:48 | jcromartie | which is fine |
| 10:48 | jcromartie | and namespace aware |
| 10:48 | jtoy_ | nDuff: what is the appropriate tool? i saw contrib.math but that seesm to be gone |
| 10:48 | nDuff | jtoy_: Math/floor |
| 10:48 | jcromartie | it's kind of a crazy API with many classes and factory factories, etc. |
| 10:48 | jtoy_ | ic |
| 10:48 | jtoy_ | thx |
| 10:48 | nDuff | jtoy_: ...see http://docs.oracle.com/javase/6/docs/api/java/lang/Math.html |
| 10:51 | nDuff | jtoy_: By the way, I'd feel more strongly if this were something where I'd put in significant effort, but you might take the views in http://yaku.dk/s/irc/dont-use-thx-sry-plz.txt into consideration. |
| 11:00 | gmailer | jcromartie: makes sense, did you look at clj-xpath at all? |
| 11:01 | gmailer | nDuff: as in, making them easier to type lessens the sentiment? |
| 11:01 | jcromartie | gmailer: yes, and it provided some helpful ideas, but I didn't like the design of it |
| 11:02 | jcromartie | I kind of took xml-> and the xpath stuff, and made xpath-> |
| 11:02 | gmailer | any plans to spin your stuff off as a standalone lib? Something with a clojure-friendly interface would be nice |
| 11:03 | nDuff | gmailer: Not caring enough to even type the word in full indicates that there's very little sentiment behind it. |
| 11:03 | gmailer | nDuff: that's very similar to drilling "please and thank you" into children, is it not? |
| 11:03 | nDuff | ...and being that _transparently_ insincere strikes me as considerably more offensive than not providing any thanks at all. |
| 11:03 | jcromartie | and I also bundle up an xpath context when the document is parsed |
| 11:05 | nDuff | gmailer: I don't have a problem with drilling "please and thank you" into children, so long as it's taught with the effort of teaching them gratitude rather than platitudes (a distinction best made by example -- demonstrating by way of how one treats others). |
| 11:06 | gmailer | probably, i'd liken "plz" to http://en.wikipedia.org/wiki/Assimilation_%28linguistics%29, making "speech" simpler but the "listener" can still understand - improving conversation flow |
| 11:42 | yogthos | tieTYT: nope, that's Chris Granger's baby http://www.chris-granger.com/ |
| 11:48 | jcromartie | very strange things happen when you forget the (cond …) part of a cond clause |
| 11:49 | clgv | ,(cond) |
| 11:49 | clojurebot | nil |
| 12:14 | TimMc | nDuff: Alternative explanation: http://hyperboleandahalf.blogspot.com/2010/04/alot-is-better-than-you-at-everything.html |
| 12:22 | drorbemet | |
| 12:27 | ciphergoth | Anyone know where I can find a good example of code that uses "ex-data"? |
| 12:27 | technomancy | ciphergoth: syme uses it |
| 12:27 | technomancy | for HTTP response codes |
| 12:28 | ciphergoth | hmm so you just catch Exception e |
| 12:29 | ciphergoth | If I just want to catch the ex-info exception, that's ExceptionInfo right? |
| 12:29 | technomancy | or clojure.lang.ExceptionInfo if you want to be more picky |
| 12:29 | technomancy | yeah |
| 12:30 | TimMc | I think slingshot uses ExceptionInfo now. |
| 12:30 | ciphergoth | right, I have to give the full name |
| 12:30 | ciphergoth | thanks |
| 12:30 | ciphergoth | Slingshot seems like overkill |
| 12:32 | gmailer | slignshot is basically just a wrapper around ex-info/ex-data |
| 12:32 | technomancy | it's pretty nice, but having ex-info alone is a huge improvement over Exception |
| 12:32 | gmailer | there's no built-in way to catch based on ex-data |
| 12:33 | technomancy | yeah, if you want to dispatch based on more than just the class you need slingshot |
| 12:34 | gmailer | i forget the exact syntax, but for example clj-http lets you do (try+ (...) (catch [:status 403] (handle-it))) |
| 12:34 | dakrone | gmailer: that's the right syntax |
| 12:35 | gmailer | huzzah! |
| 12:46 | Frozenlock | (let [x [*dyn-var*]] (binding [*dyn-var* 12] x)) ---> x != 12 :( |
| 12:46 | technomancy | how many folks use the clojuredocs client from lein repl |
| 12:46 | technomancy | ? |
| 12:46 | Frozenlock | technomancy: Well I will now... |
| 12:46 | TimMc | Frozenlock: Makes sense to me. |
| 12:47 | TimMc | Clojure automatically dereferences vars when retrieved by symbol. |
| 12:47 | Frozenlock | If I understand correctly, it must be a function evaluated inside the binding to change the result? |
| 12:48 | TimMc | ,(let [x #'*compile-path*] (binding [*compile-path* "foo"] @x)) |
| 12:48 | clojurebot | "foo" |
| 12:49 | TimMc | Frozenlock: ^ |
| 12:50 | Frozenlock | Oh boy... I think I'll just deal with some additional arguments for now.. |
| 12:52 | TimMc | Frozenlock: Yeah, your only choice is passing around the var itself. |
| 12:52 | TimMc | (or anything equivalent to that) |
| 13:01 | augustl | is it possible to at run-time create calls to java interop that are as efficient as the compile time generated interop? |
| 13:01 | augustl | or is run-time interop always reflection? |
| 13:02 | TimMc | augustl: Reflection either happens at compile time or runtime, but it happens either way. |
| 13:02 | TimMc | I guess what you're asking for is reflect-once calls. |
| 13:02 | augustl | I want to get something like [:myCall 1 2 3] passed and have that end up as (MyJavaThing/myCall 1 2 3) in an as efficient way as possible |
| 13:02 | augustl | efficient is important since they're OpenGL commands :) |
| 13:03 | augustl | so I want to be able to take [:myCall 1 2 3] run-time |
| 13:04 | augustl | perhaps I should do my own JNI to OpenGL.. |
| 13:07 | augustl | TimMc: what are reflect-once calls? :) |
| 13:07 | TimMc | A term I just made up. |
| 13:07 | augustl | :D |
| 13:07 | TimMc | As in, the reflection is either done by the Clojure compiler, your own code (while building the fn), or in some memoized fashion. |
| 13:09 | augustl | how do you actually call something without reflection? |
| 13:09 | augustl | or is reflection = getting a hold of something you can call? |
| 13:10 | Chousuke | augustl: if you know the type of the thing you're calling it's possible to emit bytecode to do it directly. |
| 13:10 | TimMc | Reflection *always* happens at some point. The compiler reflects in order to emit bytecode for a straight call, the usual runtime reflection gets ahold of a java.lang.reflect.Method object and calls that. |
| 13:10 | Chousuke | but in clojure's case the type often isn't known until runtime. |
| 13:10 | clgv | augustl: well, with reflection you usually retrieve the class of a given object and search for a method with a given name and a given signature. then you have a method object you can invoke |
| 13:11 | augustl | clgv: I see |
| 13:14 | gmailer | augustl: is there a reason you can't generate the whole interface pre-compile? |
| 13:17 | augustl | gmailer: hmm, I don't know enough about interop to understand that question I think :) |
| 13:18 | gmailer | presumably you know all of the openGL commands which exist, or you have a way to get it? |
| 13:18 | augustl | essentially I have an API that allows specification of OpenGL commands to execute at run-time. Currently, to do that you need to require OpenGL stuff and pass a function that contains the commands. I'm playing with an API where you pass something like [[:aOpenGlCommand arg1 arg2] [:anotherCommand arg1]] etc |
| 13:18 | gmailer | if you have some way of enumerating the commands beforehand, you could generate the code to map/call them |
| 13:19 | augustl | it's OK to spend some time with the list of commands when I first get them |
| 13:19 | augustl | it's for calling them 120 times a second later on that needs to be optimized :) |
| 13:20 | gmailer | i mean generate a file containing clojure code, which then gets built into the jar |
| 13:20 | augustl | the exact commands are based on user input etc |
| 13:20 | gmailer | ah |
| 13:20 | gmailer | so there isn't a finite list of possible commands? |
| 13:21 | augustl | no, the actual functions are http://lwjgl.org/javadoc/org/lwjgl/opengl/GL11.html but the parameters may vary |
| 13:22 | clgv | TimMc: ping |
| 13:23 | clgv | TimMc: I use lein-otf 2.0.1 and have ":main ^:skip-aot my.main" in the project.clj but "my.main" gets compiled. what is wrong there? |
| 13:25 | technomancy | clgv: sad face |
| 13:25 | technomancy | that's my fault |
| 13:25 | technomancy | I removed support for implicit AOT of :main before the release of lein2 |
| 13:25 | technomancy | but it got added back in without my knowledge |
| 13:26 | clgv | technomancy: oh right. just noticed. it fails for "lein install" but works for "lein uberjar" |
| 13:26 | technomancy | and the patch to add it back in didn't honor ^:skip-aot ಥ_ಥ |
| 13:26 | technomancy | clgv: 2.1.0 fixes that |
| 13:26 | technomancy | well, it fixes ^:skip-aot; it can't fix the fact that :main implies :aot unfortunately |
| 13:27 | clgv | technomancy: ah good to know. but there seems to be some asymmetrie whe "install" fails but "uberjar" works |
| 13:28 | TimMc | clgv: It's because lein-otf only hooks uberjar. |
| 13:29 | clgv | TimMc: ok. that explains it |
| 13:38 | ieure | Why oh why doesn't macroexpand work in clojure tests? |
| 13:39 | technomancy | ieure: you mean inside an clojure.test/is invocation specifically? |
| 13:40 | ieure | technomancy, Inside deftest, specifically. |
| 13:41 | TimMc | $karma TimMc |
| 13:41 | lazybot | TimMc has karma 34. |
| 13:41 | TimMc | technomancy: All my karma is over here. |
| 13:45 | technomancy | confirmed that deftest is weeeeird |
| 13:45 | technomancy | TimMc: aha; channel-local binding |
| 13:45 | tyler | is there any clojure syntax thats *not* edn syntax? |
| 13:46 | gmailer | is clojuredocs.org the "correct" place for public api docs? |
| 13:46 | TimMc | tyler: #"foo" |
| 13:46 | gmailer | it seems to be missing 1.4 and 1.5 |
| 13:47 | joegallo | gmailer: http://clojure.github.com/clojure/ |
| 13:47 | technomancy | gmailer: the docstrings are the only canonical source |
| 13:47 | TimMc | tyler: A whole bunch of reader sugar is probably not in EDN. |
| 13:47 | joegallo | i have that bookmarked as "Clojure API" |
| 13:47 | technomancy | I guess there are some special forms with missing docstrings that delegate to clojure.org reference =\ |
| 13:48 | gmailer | clojure.org/cheatsheet links to clojuredocs.org >.< |
| 13:48 | tyler | TimMc: thnx |
| 13:48 | joegallo | technomancy: right, so i have http://clojure.org/special_forms bookmarked as "Clojure Special Forms" |
| 13:48 | joegallo | 'cause i'm wicked thorough |
| 13:48 | technomancy | sucks if you're offline though |
| 13:49 | joegallo | i'm not a caveman |
| 13:49 | technomancy | haha |
| 13:49 | pjstadig | who is ever offline? |
| 13:49 | technomancy | expensing wifi whenever you fly? |
| 13:49 | joegallo | wifi? |
| 13:49 | gmailer | trains = big metal tubes = no signal |
| 13:49 | joegallo | on a plane? |
| 13:49 | joegallo | what are you, some kind of terrorist? that rf recieving equipment will crash things! |
| 13:50 | technomancy | http://www.penny-arcade.com/comic/2006/10/30/ |
| 13:50 | pjstadig | haha |
| 13:50 | pjstadig | oh man i was just gonna post an xkcd |
| 13:51 | hyPiRion | joegallo: we have wifi on the planes over here |
| 13:56 | TimMc | joegallo: I think active receivers can generate interference. |
| 13:56 | TimMc | such as GPS |
| 14:00 | Pure-Loulou | hello room :) when i recur in a function,does the garbige collector de-allocates the memory i consume? i think that when i use 1 function to allocate lots of memory,its better to break it into smaller functions.is this right? |
| 14:01 | nDuff | Pure-Loulou: recur is equivalent to an iterative algorithm. |
| 14:01 | clgv | oh, what does that mean? java.lang.NoSuchMethodError: clojure.lang.RT.mapUniqueKeys |
| 14:02 | nDuff | Pure-Loulou: ...in terms of when memory is freed, locals are cleared after the last point when they're used |
| 14:02 | nDuff | Pure-Loulou: ...so locals can be (typically, are) freed before the function actually exist. Breaking things into small functions is good practice even if you don't need to do it for memory-efficiency reasons, though. |
| 14:02 | nDuff | s/exist/exit/ |
| 14:03 | hyPiRion | ,(let [recursive (fn rec [x] (if (= x 10000) :done (rec (inc x))))] (recursive 0)) |
| 14:03 | clojurebot | #<StackOverflowError java.lang.StackOverflowError> |
| 14:03 | Pure-Loulou | nDuff, you mean the locals are freed when i reach recur?or after the fuction call returns? |
| 14:03 | nDuff | hyPiRion: I gathered Pure-Loulou to mean using recur, as opposed to recursing directly |
| 14:04 | hyPiRion | ,(let [iterative (fn [x] (loop [y x] (if (= y 10000) :done (recur (inc y))))] (iterative 0)) |
| 14:04 | clojurebot | #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]> |
| 14:04 | nDuff | Pure-Loulou: Again -- if you use recur, you don't _really_ recurse |
| 14:04 | hyPiRion | freash |
| 14:04 | jtoy_ | can anyone tell me why I cant declare this function with defonce: https://www.refheap.com/paste/12720 |
| 14:04 | hyPiRion | ,(let [iterative (fn [x] (loop [y x] (if (= y 10000) :done (recur (inc y)))))] (iterative 0)) |
| 14:04 | clojurebot | :done |
| 14:04 | hyPiRion | There, that should explain it. |
| 14:05 | nDuff | Pure-Loulou: and locals are freed as soon as they're no longer needed. If I do (let [a 12] (println a) (do-something-else)), then the a is nil before we reach do-something-else |
| 14:05 | Pure-Loulou | nDuff, thanks,i know that recur its iteration,but when i use a function tha allocates match memory during recurs,i somethimes get out of memory... |
| 14:06 | Pure-Loulou | if i break the task into smaller functions its better for memory usage and i dont know the reason |
| 14:06 | nDuff | Pure-Loulou: Can't help you without seeing a reproducer. |
| 14:07 | jtoy_ | nm, i see |
| 14:08 | clgv | I get this exception when running my project. I just got that exception when switching to Clojure 1.5.1 -> java.lang.NoSuchMethodError: clojure.lang.RT.mapUniqueKeys([Ljava/lang/Object;)Lclojure/lang/IPersistentMap; |
| 14:11 | TimMc | clgv: Needs more context. |
| 14:12 | clgv | TimMc: I build a uberjar with :skip-aot on the main using lein-otf. |
| 14:12 | callenbot | Quora should make their site suck less. |
| 14:12 | Pure-Loulou | nDuff, my example https://www.refheap.com/paste/12721 do youn know the reason for different memory usage and speed? |
| 14:13 | clgv | TimMc: that uberjar is run then. somehow it seems as if there might be two different clojure versions involved. one with and one without clojure.lang.RT.mapUniqueKeys |
| 14:14 | TimMc | clgv: Have you tried running lein clean? Sometimes classes stick around and cause trouble. |
| 14:14 | hyPiRion | and the classpath |
| 14:14 | clgv | TimMc: yes. I built with lein do clean, uberjar |
| 14:14 | hyPiRion | .lein-classpath or something |
| 14:15 | nDuff | Pure-Loulou: The broken-down one doesn't loop back as far on the inner recurs. |
| 14:15 | nDuff | Pure-Loulou: ...so they're not very equivalent logic. |
| 14:16 | Pure-Loulou | the reason is the logic or the garbage collector? |
| 14:16 | nDuff | Pure-Loulou: There are big enough obvious differences in the logic that I can't compare gc behavior. |
| 14:16 | Pure-Loulou | ok nDuff thanx :) |
| 14:16 | clgv | TimMc: oh maybe I forgot to update one clojure dependency |
| 14:17 | Pure-Loulou | maybe its just the logic not the gc |
| 14:22 | clgv | TimMc: works now :) |
| 14:31 | muhoo | slamhound is fantastic |
| 14:41 | asteve | keywords can point to functions? |
| 14:42 | arrdem | ,(( :foo {:foo identity} ) 1) |
| 14:42 | clojurebot | 1 |
| 14:42 | arrdem | yes |
| 14:43 | Pure-Loulou | nDuff, if you are here...,this is the question i have... https://www.refheap.com/paste/12724 |
| 14:44 | nDuff | Pure-Loulou: using recur will be much, much more efficient. |
| 14:44 | Pure-Loulou | a ok:) thx |
| 14:45 | Pure-Loulou | and memory efficient? |
| 14:47 | jtoy_ | what is the appropriate way to add lists together? not (+ '(1 2 3) '(4 5 6)) |
| 14:48 | asteve | I've evaluating some code that has ((keyword variable_name) function_name); which is confusing to me |
| 14:48 | asteve | (:variable_name function-name) is how I'm reading it |
| 14:49 | asteve | :variable_name in this case could point to a function? so I'd be passing a function into the input of another function, no? |
| 14:50 | jtoy_ | and its not conj |
| 14:50 | amalloy | jtoy_: what is the output you want? |
| 14:50 | Ember- | asteve: keywords are functions |
| 14:50 | Pure-Loulou | jtoy_, (map + '(1 2 3) '(4 5 6)) |
| 14:50 | Pure-Loulou | or (apply + (map + '(1 2 3) '(4 5 6))) |
| 14:51 | amalloy | it sounds like you probably want (concat '(1 2 3) '(4 5 6)) |
| 14:51 | Ember- | so (:foo bar) retrives :foo from map bar |
| 14:51 | asteve | ah! |
| 14:51 | Ember- | and the content of (:foo bar) can very well be a function |
| 14:51 | jtoy_ | Pure-Loulou: sorry, i meant (1,2,3,4,5,6) |
| 14:51 | asteve | Ember-: that second piece is what I was hoping was happening but could not rationalize |
| 14:51 | jtoy_ | conjoin them together |
| 14:51 | nDuff | jtoy_: then concat |
| 14:51 | jtoy_ | thx |
| 14:52 | asteve | Ember-: thank you for the assistance |
| 14:53 | Ember- | asteve: np |
| 15:02 | jtoy_ | is there a conj for adding to the end of a vector? |
| 15:02 | jtoy_ | oh, conj does do that for a vector, but adds to the beginning for a list |
| 15:05 | nDuff | jtoy_: conj does the most efficient thing for each datastructure. |
| 15:05 | nDuff | jtoy_: if you're trying to frequently add to the end of the list or the beginning of a vector, you should probably be using a different datastructure. |
| 15:09 | TimMc | The correct answer is always finger trees. :-P |
| 15:11 | asteve | I'd like to get a better understand of apply and when you'd use it; if I have a vector of input to a function and my function explicitly lists incoming args I'd use apply? for example, (defn foo [bar taco] (* bar taco)) and then (defn -main [vectoptions] (apply foo [vectoptions])? |
| 15:11 | amalloy | asteve: minus the []s, yes |
| 15:12 | asteve | amalloy: where do I not need the []s? |
| 15:12 | amalloy | in apply |
| 15:12 | asteve | are they not required? |
| 15:13 | amalloy | (apply f [x]) is identical to (f x), for any x |
| 15:13 | asteve | or are they logically incorrect |
| 15:13 | amalloy | they are incorrect |
| 15:13 | amalloy | your example would evaluate like (foo [bar taco]), whereas you want (foo bar taco) |
| 15:14 | asteve | is there a case for wanting (foo [bar taco])? |
| 15:14 | gf3 | That's up to you |
| 15:15 | asteve | what would foo look like to want [bar taco] as an input? |
| 15:16 | gf3 | asteve: Your initial code |
| 15:17 | TimMc | I think that's a misleading statement. |
| 15:17 | TimMc | [bar taco] as the list of args, yes -- not the single argument [bar taco], a vector of two items. |
| 15:18 | TimMc | asteve: Take a look at +. |
| 15:18 | TimMc | &(apply + [1 2 3]) |
| 15:18 | lazybot | ⇒ 6 |
| 15:18 | TimMc | &(+ 1 2 3) |
| 15:18 | lazybot | ⇒ 6 |
| 15:19 | asteve | &(+ [1 2 3]) |
| 15:19 | lazybot | java.lang.ClassCastException: Cannot cast clojure.lang.PersistentVector to java.lang.Number |
| 15:19 | asteve | got it |
| 15:19 | TimMc | And you can specify some initial args before the final one that is unwrapped. |
| 15:19 | TimMc | &(apply + 1 2 3 [4 5 6]) |
| 15:19 | lazybot | ⇒ 21 |
| 15:19 | TimMc | &(+ 1 2 3 4 5 6) |
| 15:19 | lazybot | ⇒ 21 |
| 15:28 | abp | Digging into pedestal is hard, but totally worth the effort I think. |
| 15:29 | callenbot | abp: braver man than I |
| 15:29 | callenbot | funny that we ditched Noir for being too overwrought, yet Pedestal is okay. |
| 15:29 | technomancy | it's not a framework, honest! |
| 15:29 | abp | callenbot: this ^ |
| 15:29 | callenbot | do people actually believe that? |
| 15:30 | abp | Well, parts of it, especially the rendering stuff needs a bridge for other libs. |
| 15:30 | abp | But very much of this is only to reduce web apps into a functional pipeline via queues. |
| 15:31 | callenbot | abp: put down the flavor-aid. |
| 15:31 | abp | They nailed it, there are probably some things that could be eased out without sacrificing simplicity but the stuff is seriously spot on. |
| 15:31 | abp | It's just observations. |
| 15:31 | callenbot | abp: spot on? Tell that to the frontender that has to learn clojurescript just to touch up some stuff. |
| 15:32 | technomancy | yeah, I'm mildly interested in interceptors, but I don't want to pull in a bunch of client-side transformation stuff just to use a more flexible request/response model. |
| 15:32 | abp | callenbot: It's based on enlive html-templates. |
| 15:32 | tieTYT | yogthos: did you build lighttable |
| 15:32 | callenbot | abp: I am well known for hating enlive too. |
| 15:32 | tieTYT | ? |
| 15:33 | callenbot | tieTYT: LightTable is Chris Granger aka ibdknox |
| 15:33 | tieTYT | ah |
| 15:33 | abp | callenbot: Then use clabango.. I just wanted to say there are html-templates your designer can shape. |
| 15:33 | tieTYT | what is it written in? |
| 15:33 | callenbot | abp: I'm not talking only about the HTML |
| 15:34 | callenbot | abp: I was talking about ClojureScript, in the place of JavaScript. |
| 15:34 | abp | callenbot: You can write javascript when you want to. It's just an option to write serious clientside code. |
| 15:35 | abp | callenbot: There's even a multimethod based asset pipeline for compass etc built-in. |
| 15:35 | technomancy | o_O |
| 15:35 | abp | reverse routing an terse route definition. I don't know, I think it rocks. |
| 15:36 | callenbot | compojure wasn't terse? |
| 15:36 | xeqi | abp: is that a positive or a negative? |
| 15:36 | xeqi | the asset pipeline builtin |
| 15:36 | technomancy | it actually kinda reminds me of pinot |
| 15:37 | abp | callenbot: Nope, not compared to that straight to the point definition. I was working on similiar things. The ones I've shown you quite a while back. |
| 15:37 | technomancy | "here's a bunch of unrelated pieces of functionality that I happen to use together which I will split apart into five different libraries six months down the road" |
| 15:37 | abp | xeqi: Extendable through multimethods, so rather positive. |
| 15:38 | callenbot | abp: but seriously, less kool-aid. |
| 15:38 | abp | Yeah, they could tear quite some things and bridges apart. But hey, it's alpha and kicks ass. |
| 15:38 | abp | callenbot: Heh, more respect for the really hard work done by those folks. |
| 15:39 | callenbot | we just got done reversing this kind of thing in multiple places |
| 15:39 | abp | callenbot: ffs, it's just libs. |
| 15:39 | abp | :P |
| 15:47 | thm_prover | I have ":jvm-opts [ ... "-XstartOnMainThread" ]" ... |
| 15:47 | jcromartie | so I think I came up with pretty much the best Xpath interface ever |
| 15:47 | thm_prover | now, does Lein run on mainthread, or does my clojure code run in main thread? |
| 15:47 | thm_prover | I want my clojure code to run on main thread in order that I can use swt |
| 15:47 | thm_prover | however, it appears that Lein is taking main thread |
| 15:53 | jcromartie | (-> (doc "//atom:entry[1]/atom:link[@rel='alternate']") first attrs :href) |
| 15:54 | jcromartie | (let [entry (first (*d "//atom:entry"))] (-> (entry "atom:title") text)) |
| 15:54 | jcromartie | I don't think this is abuse of IFn |
| 15:55 | jcromartie | basically I parse an XML doc into a QueryNode record which is a (Java) DOM node and an XPath context (with namespace mappings) |
| 15:55 | jcromartie | then the QueryNode implements IFn to do XPath queries |
| 15:55 | jcromartie | only for node sequences right now, but possibly for other types later |
| 15:55 | arrdem | is there a better way to run code in another namespace than (`(do (in-ns 'other) ~@sexprs)) ? |
| 15:56 | jcromartie | and each item in the returned node seqs is a QueryNode too |
| 15:57 | Glenjamin | should clojure be throwing a warning if i def something that matches a special form? |
| 15:57 | Glenjamin | i did (defn set! …) and it took me a while to realise why it didn't work |
| 15:57 | Glenjamin | (when called, not when defined) |
| 16:00 | tomoj | Glenjamin: no |
| 16:01 | Glenjamin | is that because it's available fully namespaced? |
| 16:01 | tomoj | that's why I want clojure not to throw an error there |
| 16:01 | tomoj | :) |
| 16:02 | Glenjamin | it warns when i define something thats also available in clojure.core |
| 16:02 | Glenjamin | (def get) ; => warning (def set!) ; => nothing |
| 16:02 | tomoj | so (foo/if x y z) works |
| 16:03 | tomoj | yeah.. just how special forms are |
| 16:03 | tomoj | &set! |
| 16:03 | lazybot | java.lang.SecurityException: You tripped the alarm! set! is bad! |
| 16:03 | Glenjamin | hrm, can i make the current namespace available under a short name? |
| 16:03 | SegFaultAX | Glenjamin: Add a refer-clojure exclude in your namespace decl so it's obvious you're shadowing that var. |
| 16:03 | tomoj | well, lazybot is stupid, there is no set! |
| 16:03 | TimMc | ,set! |
| 16:03 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: set! in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 16:04 | tomoj | (alias 'f 'foo) |
| 16:04 | Glenjamin | basically i've got an app.config namespace, with a (get) and a (set!) |
| 16:04 | SegFaultAX | Glenjamin: Then explicitly exclude get from your namespace. |
| 16:06 | tomoj | you can do (alias 'c 'app.config) under (ns app.config ...) and then (c/set! ...) will work later in app.config. maybe just rename it though? :) |
| 16:07 | jcromartie | can I use varargs when implementing protocols? |
| 16:07 | jcromartie | like, inside a defrecord spec |
| 16:10 | amalloy | no |
| 16:10 | jcromartie | amalloy: thanks :) |
| 16:14 | jcromartie | I appreciate that I can combine :as and :refer in the same :require |
| 16:14 | jcromartie | (:require foo.bar.bat :as bat :refer (zort troz)) |
| 16:22 | arrdem | can I force macros to resolve symbols using ns-specific qualified names rather than absolute names? |
| 16:23 | arrdem | eg. (require ['clojure.pprint :as pp]), `(pp/pprint foo) -> (pp/pprint foo) not (clojure.pprint/pprint foo) |
| 16:27 | Raynes | arrdem: When you require something :as anything, the fully qualified names are still available. |
| 16:28 | Raynes | arrdem: So if you do that require, you can still refer to pprint as clojure.pprint/pprint and it'll work fine. |
| 16:28 | arrdem | Raynes: ofc. I'm just looking for a way to use the abbreviated name in macroexpansions short of ~' ing all my symbols |
| 16:28 | arrdem | s/use/get out/ |
| 16:28 | Raynes | Why do you want to do that though? |
| 16:29 | arrdem | I'm working on a toolkit that generates potentially huge ammounts of code which is intended for long-term storage not emmidiate evaling |
| 16:30 | arrdem | the project is http://github.com/arrdem/sad |
| 16:30 | arrdem | the idea is that rather than implement an entire grammar by hand in fnparse you just feed it in and sad spits out the equivalent fnparse code. |
| 16:31 | arrdem | so I would like the generated code to be readable (using abbreviated names) not obfuscated by fully qualified ones. |
| 16:32 | drorbemet | Which is the fast way to check if a clojure.set contains an element? Do I have to put the element in a set first and apply subset? ? |
| 16:33 | arrdem | ,(contains #{3} 3) |
| 16:33 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: contains in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 16:33 | arrdem | ,(clojure.set/contains #{3} 3) |
| 16:33 | clojurebot | #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.set> |
| 16:33 | arrdem | goddamnit bot |
| 16:33 | drorbemet | Ah ok thanks |
| 16:33 | arrdem | drorbemet: fair warning I may have the literal and the collection backwards... |
| 16:34 | arrdem | ah it's contains? |
| 16:34 | arrdem | ,(contains? #{3} 3) |
| 16:34 | clojurebot | true |
| 16:34 | arrdem | HAH |
| 16:34 | arrdem | drorbemet: ^^ |
| 16:34 | nDuff | ,(#{3} 3) |
| 16:34 | clojurebot | 3 |
| 16:34 | nDuff | ,(#{3} 2) |
| 16:34 | clojurebot | nil |
| 16:34 | arrdem | or that. |
| 16:34 | nDuff | drorbemet: ^^ |
| 16:36 | drorbemet | nDuff: I have some problems at the moment, I come back with a better prepared question |
| 16:37 | Glenjamin | is there a shorthand to add more than one boolean metadata flag? |
| 16:38 | drorbemet | nDuff: Thanks, I figured it out |
| 16:38 | jjido | like a set? |
| 16:38 | Glenjamin | something like ^[:dynamic :private] |
| 16:38 | arrdem | Glenjamin: (def ^{:dynamic true :private true} foo 3) ? |
| 16:39 | Glenjamin | yeah, was hoping for something to drop the trues, but not exactly important |
| 16:40 | arrdem | Glenjamin: the semantics of Clojure maps demand that you have <key, val> pairs inline, unless you wanted to implement some funky macro there's no way around that. |
| 16:40 | mthvedt | Glenjamin: |
| 16:40 | mthvedt | user=> (def ^:dynamic ^:private abc 1) |
| 16:40 | mthvedt | #user/abc |
| 16:40 | mthvedt | user => (meta #'abc) |
| 16:40 | mthvedt | {:ns #<Namespace s3sync.core>, :name abc, :dynamic true, :column 1, :private true, :line 1, :file "NO_SOURCE_PATH"} |
| 16:40 | Glenjamin | heh |
| 16:40 | arrdem | (inc mthvedt) |
| 16:40 | lazybot | ⇒ 1 |
| 16:40 | Glenjamin | why didn't i try that >.< |
| 16:41 | mthvedt | woo |
| 16:41 | mthvedt | no longer a 0 |
| 16:41 | arrdem | TIL XP and that's worth karma |
| 16:41 | arrdem | $karma arrdem |
| 16:41 | lazybot | arrdem has karma 1. |
| 16:49 | jcromartie | XPath is a nice dynamic language that gets rather constrained by Java |
| 16:49 | yedi | what's all this stuff about pedestal's interceptor model about |
| 16:50 | yedi | anyone have a link or something? |
| 16:51 | abp | yedi: http://pedestal.io/documentation/service-interceptors/ |
| 16:51 | abp | yedi: Probably want to read overview first. |
| 16:55 | nDuff | ...but then, one can actually do real work in XQuery (database lookups, HTTP requests, etc etc) as opposed to being _strictly_ a query language. |
| 16:58 | jtoy_ | how would you recommend I get a vector back that has the last element removed? |
| 16:58 | arrdem | jtoy_: ,(doc butlast) |
| 16:58 | arrdem | ,(butlast [1 2 3 4]) |
| 16:58 | clojurebot | (1 2 3) |
| 16:58 | S11001001 | no |
| 16:58 | jtoy_ | sweet |
| 16:58 | arrdem | S11001001: ?? |
| 16:58 | lazybot | arrdem: Definitely not. |
| 16:59 | arrdem | lazybot: gtfo |
| 16:59 | S11001001 | arrdem: sorry, lazybot agrees with me |
| 16:59 | S11001001 | ,(doc pop) |
| 16:59 | clojurebot | "([coll]); For a list or queue, returns a new list/queue without the first item, for a vector, returns a new vector without the last item. If the collection is empty, throws an exception. Note - not the same as next/butlast." |
| 16:59 | Frozenlock | This is confusing... |
| 16:59 | S11001001 | jtoy_, arrdem: butlast not only doesn't return a vec, as you see, it's also O(n). pop has neither limitation |
| 17:00 | arrdem | ah. |
| 17:00 | S11001001 | ,(doc butlast) |
| 17:00 | clojurebot | "([coll]); Return a seq of all but the last item in coll, in linear time" |
| 17:00 | jtoy_ | ah, yes |
| 17:01 | S11001001 | additionally, iteratively calling butlast has the same stack problems as iteratively `concat'ing to the end of a seq |
| 17:01 | Frozenlock | Isn't there a function that automatically choose when to use butlast/pop? |
| 17:01 | S11001001 | doubt it |
| 17:01 | S11001001 | it has been observed by others that using cons and pop for stack management is faster than using vec as a stack |
| 17:01 | S11001001 | worth considering |
| 17:02 | Frozenlock | Would (defn butlast* [coll] (if (vector? coll) (pop coll) (butlast coll))) be efficient? |
| 17:03 | S11001001 | albeit pretty much useless |
| 17:05 | Frozenlock | How so? Isn't the need to remember to use `pop' instead of `butlast' an unnecessary step? |
| 17:05 | S11001001 | It's a statement of truth about the code it appears in. |
| 17:06 | S11001001 | butlast and pop are considered to cover the universe of common ideas you would express in code. The ability to deal with arbitrary seqs is at odds with making assumptions about what operations are safe or efficient on a particular domain of seqs |
| 17:06 | S11001001 | IOW, if you are writing code that iteratively pops, you should just say pop |
| 17:06 | S11001001 | note that "conj" has exactly the same front-or-back behavior |
| 17:07 | Frozenlock | Which is another thing that I find confusing. -_- |
| 17:07 | Frozenlock | I'm not as smart as you guys. |
| 17:07 | clojurebot | excusez-moi |
| 17:08 | amalloy | S11001001: butlast is definitely a bad solution, but calling it O(n) is a bit misleading |
| 17:09 | amalloy | it's a lazy operation, and returns items when it can |
| 17:09 | nDuff | Frozenlock: ...the thing to remember is that you can trust functions to do only what they promise to do. conj doesn't promise anything about _where_ things go, so it does whatever's convenient. |
| 17:10 | nDuff | Frozenlock: ...that way you can pick the function that has only the constraints that you need, so the implementation can be fast/cheap if it can optimize things away by not delivering on promises you don't need. |
| 17:11 | Frozenlock | ,(doc conj) |
| 17:11 | clojurebot | "([coll x] [coll x & xs]); conj[oin]. Returns a new collection with the xs 'added'. (conj nil item) returns (item). The 'addition' may happen at different 'places' depending on the concrete type." |
| 17:11 | Frozenlock | So if I use conj and pop, everything will 'work' as expected. It's if I try to build on orders than things get more complicated? |
| 17:13 | Frozenlock | ,(pop (conj '(1 2 3) 4)) |
| 17:13 | clojurebot | (1 2 3) |
| 17:13 | Frozenlock | ,(pop (conj [1 2 3] 4)) |
| 17:13 | clojurebot | [1 2 3] |
| 17:13 | Glenjamin | is there a built-in function to do (merge m (f m)) ? |
| 17:14 | technomancy | juxt! |
| 17:14 | technomancy | (not really) |
| 17:15 | Frozenlock | merge-with? |
| 17:15 | brehaut | (comp (partial apply merge) (juxt identity f)) |
| 17:16 | technomancy | brehaut: so much more abstract amirite |
| 17:16 | Glenjamin | heh, i've found myself doing it a lot with ring maps |
| 17:16 | brehaut | technomancy: you can take my points, but you will never take my freedom |
| 17:16 | Frozenlock | Burn the land and boil the sea... |
| 17:17 | Glenjamin | brehaut: can you generalise to [m & fns] ? |
| 17:17 | technomancy | =D |
| 17:17 | pjstadig | not exactly a built in function |
| 17:18 | brehaut | Glenjamin: not without wasting too much of my life |
| 17:18 | Glenjamin | heh :) |
| 17:18 | Glenjamin | getting into haskell territory |
| 17:24 | brehaut | arrdem: oh? |
| 17:24 | arrdem | brehaut: fnp/effects doesn't seem to be behaving the way I expect. |
| 17:26 | brehaut | arrdem: hmm. i dont know if i ever used that form |
| 17:28 | brehaut | arrdem: it looks like (effects …stuff…) wraps up side effects that can consume input and then returns the state to what it was prior to the effects being called? |
| 17:29 | arrdem | brehaut: where are you reading that? Choi's wiki says its (effects rule fn) calls fn for side-effects then rule. |
| 17:29 | abp | https://github.com/pedestal/pedestal/blob/master/app/src/io/pedestal/app/query.clj there we go. :) |
| 17:29 | brehaut | arrdem: i went and looked at the code (in the factual fork). i could be well wrong though |
| 17:30 | arrdem | brehaut: okay that makes more sense actually. thanks. |
| 17:30 | brehaut | arrdem: https://github.com/Factual/fnparse/blob/master/src/name/choi/joshua/fnparse.clj#L381-L386 |
| 17:31 | brehaut | arrdem: at this point i also dont trust the original repo or related content to be remotely up todate or relevant |
| 17:31 | arrdem | brehaut: agreed... |
| 17:31 | brehaut | arrdem: that also goes for my blog posts if you happen to stumble on them |
| 17:31 | arrdem | just the first thing Chrome pops up when I enter C-l fnparse XP |
| 17:32 | arrdem | brehaut: noted thanks |
| 17:32 | brehaut | (i think the gist of them is still sound, but the specifics may be off) |
| 17:35 | arrdem | sorta like clojuredocs.org! |
| 17:38 | brehaut | wait, which one is that |
| 17:38 | brehaut | the old one? |
| 17:38 | arrdem | yeah. |
| 17:39 | arrdem | which one is the new one? |
| 17:39 | brehaut | clojure-doc.org |
| 17:39 | brehaut | not confusing at all ;) |
| 17:40 | amalloy | i'll register do-clojure.net |
| 17:40 | arrdem | ah I was under the impression that it was clojure-docs.org which doesn't exist |
| 17:40 | amalloy | that should clear things up |
| 17:40 | arrdem | -________- |
| 17:40 | Raynes | amalloy: I think you mean doc-clojure.net |
| 17:40 | amalloy | there's already a C there, mate |
| 17:40 | Raynes | Get off my internet. |
| 17:40 | cap10morgan | is it possible to tell leiningen to use a local copy of a library instead of the one it downloaded? (i.e. a git clone I modified and want to test) |
| 17:41 | arrdem | cap10morgan: as of Lein 2.0 you have to actually build the library and install it with Maven before Lein will touch it. |
| 17:41 | blrm | arrdem: I've made that mistake enough to consider just buying the domain and redirecting :) |
| 17:42 | cap10morgan | arrdem: ok, bummer |
| 17:42 | brehaut | arrdem, cap10morgan really? lein install works fine for me without any fancy setup |
| 17:42 | tieTYT | {:pre [(not-nil? d) (not-nil? precision)]} |
| 17:42 | tieTYT | is not-nil? assumed to be a predicate? |
| 17:43 | tieTYT | or does it throw an error if something is null? |
| 17:43 | antares__ | arrdem: not at all, just use Leiningen checkouts |
| 17:44 | arrdem | brehaut: oh yeah that'd do it. |
| 17:44 | arrdem | cap10morgan: if you can build from source, the lein install thang that brehaut mentioned 'll do for ya |
| 17:44 | brehaut | phew. i was really worried i had been developing code under some deep hallucination |
| 17:44 | antares__ | cap10morgan: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies |
| 17:44 | arrdem | if jar then the maven stuff applies. |
| 17:45 | antares__ | arrdem: there is no need to build Leiningen-managed projects from source to install locally, just use checkouts: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies |
| 17:47 | cap10morgan | ah, yep, lein install worked. thanks brehaut, arrdem |
| 17:47 | arrdem | cap10morgan: np, happy lisping! |
| 17:51 | TimMc | < brehaut> technomancy: you can take my pants, but you will never take my freedom |
| 17:51 | TimMc | I think I may have misread that. |
| 17:52 | brehaut | TimMc: i have a hellboy comic for you |
| 17:52 | tomoj | sweet, taking 5e5 samples per second from a multinomial with 10e6 outcomes https://www.refheap.com/paste/2f6b52745b5b1ab11cb04a214 |
| 17:53 | Glenjamin | here we go, apply functions to map and merge recursively |
| 17:53 | Glenjamin | https://gist.github.com/glenjamin/5200480 |
| 17:54 | Glenjamin | can't decide if its worth using though :s |
| 17:56 | brehaut | TimMc: http://media.brehaut.net/files/tmp/pants.jpeg |
| 18:07 | tomoj | apparently 1 out of 5e6 words is "foo" |
| 18:08 | tomoj | 4e6 |
| 18:09 | tyler | whats the diff between ^:foo and #^:foo ? |
| 18:09 | tomoj | #^ is archaic |
| 18:10 | tyler | ah, saw it in a slide |
| 18:10 | tyler | i was like dafuq?! |
| 18:11 | TimMc | Frozenlock: o/ |
| 18:11 | Frozenlock | \o |
| 18:12 | Frozenlock | I'm still convinced that I can be funny. One day I'll succeed. |
| 18:12 | brehaut | tyler: side effecting predicates are a code smell |
| 18:12 | TimMc | I got the reference, but I'm just a minor fan. |
| 18:12 | arrdem | what |
| 18:12 | Frozenlock | You can't be just a minor fan :P |
| 18:12 | tieTYT | named parameters seem a little weird. You don't wrap the input in a {}? |
| 18:12 | arrdem | ,(:foo) |
| 18:12 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Wrong number of args passed to keyword: :foo> |
| 18:13 | Frozenlock | arrdem: a keyword is a function (for a map) |
| 18:13 | TimMc | brehaut: (defn side-effecting? [f] (System/exit 5) false) |
| 18:14 | TimMc | (nothing is side-effecting once the JVM is shut down) |
| 18:14 | brehaut | TimMc: that should be 'side-effecting?! |
| 18:14 | TimMc | Oh, point. |
| 18:14 | brehaut | which it turns out was extremely difficult for me to type with my interrobang substitution |
| 18:15 | S11001001 | brehaut: nah, not unless it fails when called in a transaction |
| 18:16 | TimMc | S11001001: But it does! |
| 18:16 | brehaut | S11001001: way to spoil a good joke with specifics :P |
| 18:16 | TimMc | I'm not sure what (System/exit 5) is *besides* failing. |
| 18:16 | brehaut | TimMc: i think he's complaining about my nomenclature about ! functions |
| 18:16 | S11001001 | TimMc: I'd call that a successful commit |
| 18:17 | TimMc | How so? |
| 18:17 | TimMc | "It is not the case that there is a transaction that will retry"? |
| 18:17 | S11001001 | causes all active transactions to succeed immediately before exiting |
| 18:17 | jtoy_ | can i use leinengein to use code that is on github? a fork of a project that is on clojar ? |
| 18:17 | S11001001 | including the currently active one, if such a one exists |
| 18:17 | S11001001 | (in this thread) |
| 18:18 | TimMc | S11001001: In that case, side-effecting?¡ |
| 18:19 | TimMc | since it causes transactions to succeed |
| 18:20 | S11001001 | cool |
| 19:42 | jtoy_ | with with-open how could I skip the first line |
| 19:42 | jtoy_ | for example with a csv file i want to skip the header |
| 19:44 | ed_g | jtoy: I would use the data.csv parser and then just use (rest csv-output) |
| 20:08 | jimkcar | can someone tell me if this is an ok thing to do? or is there something better to do? https://www.refheap.com/paste/12734 |
| 20:09 | ed_g | #( ) form will expect an argument. I'd use (fn [] (println "you did command X") instead |
| 20:10 | jimkcar | ok. In the real code, I'm just putting the name of various defn declarations in there. |
| 20:11 | ed_g | oops #( ) is OK never mind. |
| 20:11 | ed_g | jimkcar: are you asking in terms of using untrusted input? |
| 20:12 | jimkcar | ed_g: no, its for a repl/shell app. If what they type isn't in the cmd-map, it just tries to eval it as if they were at the repl |
| 20:13 | jimkcar | just trying to emulate another set of shell commands without making users type (cmd) all the time |
| 20:17 | ed_g | if they type a command thats not in your map, looks like clojure will try to run (nil) and throw an exception. maybe (when (contains? (keyword cmd) cmd-map) ((get cmd-map (keyword cmd)))) |
| 20:18 | tyler | can clojure apps access namespaces in cljs files? |
| 20:21 | jimkcar | ed_g: that's a good idea. I was going to (try ... (catch ...)) it, but I always hate catching errors as flow control |
| 20:26 | arrdem | thoughts on potemkin? |
| 20:38 | callenbot | danlarkin: what would it take to get proper escaped-by-default behavior in Clabango? |
| 20:38 | callenbot | I'm looking at the ast/token/realize stuff right now, trying to figure out where a good place for this live would be. |
| 20:38 | jonasac | what is the idiomatic way to spin up async threads that are supposed to run eternal read loops, i need access to the output ? |
| 20:39 | callenbot | jonasac: eternal? |
| 20:39 | callenbot | jonasac: like an async server? |
| 20:39 | callenbot | jonasac: you could use a buffer that could be drained off. There's more serious servery stuff in Lamina. |
| 20:41 | jonasac | callenbot: lamina looks cool |
| 20:41 | callenbot | jonasac: ztellman does good work, but you didn't explain enough of what you want for me to get any more detailed. |
| 20:41 | tomoj | is a PersistentVector with 64 elements always a tree with two full leaves? |
| 20:44 | jonasac | callenbot: im not really sure either, looking around for inspiration |
| 20:45 | callenbot | jonasac: if you don't know what you want, you ain't gonna need it. |
| 20:48 | devn | leveling up on pedestal and enjoying it thoroughly |
| 20:49 | devn | </status> |
| 20:49 | callenbot | devn: liking it eh? anything to report? |
| 20:49 | callenbot | devn: gimme data! |
| 20:51 | devn | callenbot: nothing you probably don't know, just rewriting some backend services using it |
| 20:52 | devn | specifically liking the whole route generation setup |
| 20:52 | squidz | Ive been programming a little bit in clojure, and have had the feeling that I am getting used to it, but today I came across a problem that just didnt seem to click with clojure. Basically I have to test some rules for Sudoku. Those being, every row/column must contain numbers 1-9, and that each 3x3 subsection must contain the numbers 1-9. I split up the problem by smaller steps, and one of those steps is what is confusing me. I am trying to extract all 3x3 s |
| 20:53 | squidz | the board is 9x9 btw. meaning that there are 9 sub-blocks |
| 20:53 | devn | squidz: maybe some use of partition is what you're looking for? |
| 20:54 | devn | ,(partition 3 1 (range 25)) |
| 20:54 | clojurebot | ((0 1 2) (1 2 3) (2 3 4) (3 4 5) (4 5 6) ...) |
| 20:54 | squidz | devn: that definitely seems to be in the right direction |
| 20:55 | devn | ,(zipmap (partition 3 1 (range 100)) (partition 3 1 (range -99 1))) |
| 20:55 | clojurebot | {(0 1 2) (-99 -98 -97), (32 33 34) (-67 -66 -65), (64 65 66) (-35 -34 -33), (96 97 98) (-3 -2 -1), (1 2 3) (-98 -97 -96), ...} |
| 20:55 | callenbot | devn: I'm considering building my next (mostly simple static content) project in it. |
| 20:55 | devn | squidz: also look into zippers in clojure |
| 20:55 | squidz | I am using a 2D vector for the representation of my sudoku board. I thougt about partition, even though I forgot that clojure had the function already, but I still am not sure what would be the best way to retain that informaiton while moving through each 'row'. |
| 20:56 | devn | reduce, reductions? |
| 20:56 | devn | ,(reductions conj [] [1 2 3]) |
| 20:56 | clojurebot | ([] [1] [1 2] [1 2 3]) |
| 20:57 | squidz | devn: ah the zipmap looks good. I also thought about reductions, but havent considered it much further than just consideration |
| 20:57 | devn | squidz: *nod* -- there are a lot of ways to do it, just making some naive suggestions |
| 20:58 | devn | squidz: you could peek around here a bit (still very much unfinished, but if you're looking to browse some examples of transformations to get ideas) http://getclojure.org/ |
| 20:58 | squidz | yeah that's what I was hoping for. Just vague ideas on how I could do it. Ill do the work to get it going. Just wanting to get better grips on the 'clojure' way of doing things |
| 21:00 | Sgeo | Hey, is ClojureWest going on now? |
| 21:00 | devn | squidz: Sgeo yeah |
| 21:00 | Sgeo | I'm curious as to the Racket presentation that will occur |
| 21:00 | devn | err Sgeo: yeah |
| 21:04 | amalloy | squidz: https://www.refheap.com/paste/8cecd2392c04c4cd9d7690ab9 ? |
| 21:05 | amalloy | throw in some (vec) calls there if for some reason you need the subgrids to be vectors |
| 21:06 | amalloy | i have trouble seeing how to use reduce, reductions, or partition here |
| 21:07 | squidz | amalloy: It seems like your solution might work. I will have to try it out. |
| 21:12 | squidz | amalloy: hm I just realized that I wanted the partitions to be kind of mini-versions of the whole sudoku board. That is, with nested vectors like so [[1 2 3] [4 5 6] [7 8 9]] |
| 21:12 | amalloy | in that case, read the messages i already sent about that |
| 21:12 | squidz | ah okay i see what you meant now |
| 21:44 | ToxicFrog | Design question. |
| 21:45 | ToxicFrog | I have here (in effect) a list of '(regex function) pairs. When a line of text is read, the function corresponding to the first matching regex is called. |
| 21:45 | ToxicFrog | However, this process is slightly stateful. In particular, the dispatch of some lines depends on tokens read from earlier lines. |
| 21:46 | ToxicFrog | This is all happening in the same thread. |
| 21:46 | ToxicFrog | In Lua, I'd just slap a file-local variable at the top and close all of the functions over it, mutating it as needed. |
| 21:47 | ToxicFrog | I'm not sure what the closest equivalent is in Clojure (def at the top of the file, def again to mutate?) or even if that's the correct approach (I could, for example, instead have each function return a state-value which is preserved by the caller and passed to the next function) |
| 21:47 | ToxicFrog | Advice? |
| 21:47 | clojurebot | live every week, like it is shark week! |
| 21:47 | ToxicFrog | ...thank you for that, clojurebot. |
| 21:49 | brehaut | ToxicFrog: you have a few options. most obvious is state-m, but thats potentially heavy handed. you could keep some addional state in an atom also closed over, or you could implement it as a state machine, where each function in the list returns a value and the next state |
| 21:49 | brehaut | ToxicFrog: deffing for mutation is verboten. redef is only for dev time |
| 21:50 | brehaut | ToxicFrog: you can trivially close over a local in just the same way using let (or a function parameter) |
| 21:51 | kwertii | You could make a recursive function that passes an accumulator with the state (a map or whatever else is convenient) to itself, along with the next line |
| 21:54 | brehaut | kwertii: it doesnt even need to be explicitly recursive. reduce over a seq of lines would be sufficient |
| 21:56 | kwertii | brehaut: true. I like that solution. |
| 21:59 | ToxicFrog | Ok, additional context - most of the line processing is stateless, and I'm using saturnine for this, so the existing flow is basically "line arrives, handler gets called, handler scans regex list to find the real handler function, calls that" |
| 22:00 | ToxicFrog | This also means I have existing support for "each function returns the next state". |
| 22:01 | brehaut | it sounds like its not really a question then eh. just do that |
| 22:01 | pocho | I just included the clj-kdtree into my project.clj and now my compiler can't find mapv. What gives? |
| 22:02 | ToxicFrog | Yeah, I was just second-guessing myself because I'm coming from a language where "close everything over a mutable local and then mutate the shit out of it" is the natural approach. |
| 22:02 | brehaut | pocho: likely somehting has version clamped you to an old version of clojure |
| 22:03 | brehaut | pocho: *clojure-version* from your repl will tell you the version in use, and lein deps :tree from the command line will list the dependancies so you can be sure which version is pulling what in |
| 22:03 | brehaut | pocho: also, from memory the lein plugin lein-pedantic will warn you about about some classhing version problems |
| 22:08 | amalloy | ToxicFrog: most instances of "iteratively mutate a global" can be transformed pretty mechanically into "reduce over a state local" |
| 22:09 | brehaut | pocho: looking at https://clojars.org/clj-kdtree its definately the cause; its clamped to a version range (see also http://nelsonmorris.net/2012/07/31/do-not-use-version-ranges-in-project-clj.html) |
| 22:09 | brehaut | pocho: you can try using an exclusion to fix it |
| 22:10 | tomoj | hmm |
| 22:10 | tomoj | for a while every time I evaluated 0 in the repl, I saw ~5MB increase in memory usage by my process |
| 22:11 | brehaut | O_o |
| 22:11 | tomoj | after allocating a bunch of direct byte buffers with their only remaining references *1 etc |
| 22:12 | brehaut | pocho: https://github.com/technomancy/leiningen/blob/stable/sample.project.clj#L38 for an example of a lein exclusion |
| 22:12 | tomoj | I can't reproduce now.. |
| 22:12 | arrdem | why does github not automagically make the doc wiki a submodule /doc ? |
| 22:12 | tyler | ohpauleez: if i want to make remote calls via XHR is shoreleave the best way to do it? |
| 22:13 | ohpauleez | are you making them to your server? |
| 22:13 | ohpauleez | or CORS |
| 22:14 | technomancy | arrdem: because submodules can't point to references, only specific revisions |
| 22:14 | ohpauleez | tyler: The best way for interacting with your server is remotes. Specifically, use the macro. If you're calling an external server that you own (like Solr), use JSONP to avoid the CORS headache. |
| 22:14 | arrdem | technomancy: TIL thanks |
| 22:14 | ohpauleez | if your server is in a different language (not Clojure), you can use the base xhr remote calls |
| 22:14 | pocho | brehaut: The project.clj on github says it's 1.4.0 compatible. https://github.com/abscondment/clj-kdtree/blob/master/project.clj |
| 22:14 | brehaut | pocho: did you download from github or clojars? |
| 22:15 | tyler | ohpauleez: thnx |
| 22:15 | pocho | brehaut: clojar. Would it be less painful to get the version from github or use :exclude? |
| 22:15 | nonuby | what are the alternatives to (take 10 (interleave (iterate inc 0) (iterate dec -1))) - just wondering as it took me a while to figure this implementation out expected is a lazy seq that goes 0 -1 1 -2 2 -3 3 and so fotth |
| 22:15 | tyler | ohpauleez: im experimenting using a full clojure stack sending edn as data format, im a clojurescript noob heh |
| 22:16 | ohpauleez | tyler: Awesome! In that case you'll definitely want to use the remotes |
| 22:16 | technomancy | pocho: best to do :exclude |
| 22:16 | technomancy | maybe file a bug report if the project isn't abandoned |
| 22:16 | tyler | i usually proxy remote services |
| 22:16 | brehaut | ~version ranges |
| 22:17 | clojurebot | version ranges are nothing but trouble: http://nelsonmorris.net/2012/07/31/do-not-use-version-ranges-in-project-clj.html |
| 22:17 | ohpauleez | tyler: Also have a look at pedestal: http://pedestal.io/ |
| 22:17 | amalloy | &(take 10 (rest (mapcat (juxt - +) (range)))) |
| 22:17 | lazybot | ⇒ (0 -1 1 -2 2 -3 3 -4 4 -5) |
| 22:17 | tyler | ohpauleez: i saw it with everyone else ;) it looks cool. i have the firsst mailing list post, which was an actual bug :))) |
| 22:17 | brehaut | amalloy: nice :) |
| 22:17 | nonuby | amalloy, interesting! |
| 22:18 | technomancy | you sly dog |
| 22:21 | tyler | mapcat wins the award for cutest function name |
| 22:21 | nonuby | any others? side effect: discovered juxt :) |
| 22:22 | ToxicFrog | lazy-cat? |
| 22:22 | muhoo | cors? |
| 22:23 | ToxicFrog | We need a lazymapcat, or possibly an excuse to use "kitten" in a function name. |
| 22:26 | trptcolin | does anyone else try and use `man` as an alias for `doc` in the REPL? |
| 22:26 | brehaut | trptcolin: nope. i get tripped up and try help occasionally (curse you, python) |
| 22:27 | brehaut | ToxicFrog: (def lazymapcat mapcat) ; job done |
| 22:28 | technomancy | obligatory http://spl.smugmug.com/Humor/Lambdacats/13227630_j2MHcg#!i=1503651799&k=dVj9xxz |
| 22:28 | trptcolin | brehaut: nice, yeah, that should work. maybe i'll alias it in reply. not before it gets more modular/configurable though |
| 22:28 | kwertii | I remember thinking sometime in the late 80s that all computer systems which accept any kind of text input from a human ought to at least respond to the string "help" intelligently |
| 22:28 | technomancy | leiningen does better; it responds to halp as well |
| 22:28 | kwertii | nice |
| 22:29 | trptcolin | lol, i was just thinking i'd include that as an alias |
| 22:29 | brehaut | while you are there, you could alias wat to (pst) |
| 22:30 | trptcolin | hehe |
| 22:30 | technomancy | i-dont-even |
| 22:30 | brehaut | dont forget O_o |
| 22:31 | trptcolin | ah crap, gotta normalize that one, i use o_O |
| 22:31 | brehaut | haha |
| 22:31 | technomancy | they're matching delimiters obvs |
| 22:31 | brehaut | haha |
| 22:32 | brehaut | technomancy: i want to know what kind of data structure (╯°□°)╯︵ ┻━┻ and ┻━┻ ︵ ╰(°□° ╰) bound |
| 22:32 | Apage43 | tables of some sort |
| 22:33 | TimMc | *Inverted* tables of some sort |
| 22:35 | tyler | ohpauleez: im stuck on how to define the function on the serverside to call with rpc |
| 22:36 | Apage43 | clojure.set/map-invert |
| 22:36 | ohpauleez | tyler: You can either use (defremote …) for one off endpoints, or expose an entire server-side ns as an API endpoint |
| 22:36 | ohpauleez | I typically do that latter |
| 22:36 | ohpauleez | see shoreleave-baseline 's kitchen-sink branch |
| 22:36 | nonuby | give a list '( { :dt #} { :dt #} {:dt # } .. ~x100) how can I take X from the list from the point where item matches predicates |
| 22:37 | ohpauleez | https://github.com/shoreleave/shoreleave-baseline/tree/kitchen-sink |
| 22:37 | tyler | ohpauleez: in the readme you require "noir.shoreleave.rpc".... that is confusing is the readme out of date or am i missing something? |
| 22:37 | tyler | ohpauleez: thnx |
| 22:37 | ohpauleez | In what readme? |
| 22:38 | ohpauleez | all of the readme docs probably need to be scrubbed. The source of truth are the marg docs and baseline |
| 22:39 | ohpauleez | https://github.com/ohpauleez/shoreleave#wheres-the-code |
| 22:39 | tyler | https://github.com/shoreleave/shoreleave-remote/blob/master/README.mkd |
| 22:39 | ohpauleez | yeah, I just spotted that as well |
| 22:39 | ohpauleez | I need to get to all of the READMEs |
| 22:41 | tyler | i don't see defremote anywhere on http://shoreleave.github.com/shoreleave-remote/ |
| 22:41 | tyler | is it in a different repo? |
| 22:42 | ohpauleez | yes, it's in the ring piece |
| 22:42 | nonuby | is the defn [] an implicit recur point of do i need to add loop? |
| 22:42 | ohpauleez | I'll nab it for you |
| 22:42 | tyler | ah |
| 22:42 | tyler | ohpauleez: thnx |
| 22:43 | ohpauleez | http://shoreleave.github.com/shoreleave-remote-ring/#shoreleave.middleware.rpc |
| 22:43 | ohpauleez | tyler: ^ |
| 22:43 | tyler | danke |
| 22:43 | ohpauleez | (defremote remote-fn [arg1 arg2 ...] ...) |
| 22:43 | ohpauleez | this README is also outdated, but it'll give you the right idea: https://github.com/shoreleave/shoreleave-remote-ring |
| 22:46 | ohpauleez | tyler: I apologize for the broken docs. I've been busy with: http://ndensity.com/ |
| 22:47 | tyler | ohpauleez: nice |
| 22:52 | tyler | so is the reason people are into FRP is because it allows you to do async javascript without having to do callbacks? |
| 22:52 | tyler | or am i way off base |
| 22:52 | ohpauleez | people are into it for a variety of reasons, and it is very much dependent on the type of client-side work you are doing |
| 22:53 | ohpauleez | declaratively constructing your application in terms of actions/functions and the composition therein is one of the more compelling ones |
| 22:54 | ohpauleez | I'm of the opinion that at the core of these FRP systems, is the notion of a raw c2-event system - a pub/sub with many publishers and many subscribers (more or less) |
| 22:55 | ohpauleez | and that the raw pub/sub abstraction should be exposed and provided for constructing dataflows with pure functions |
| 22:56 | ohpauleez | this is the general approach promoted in Shoreleave. It's certainly the approach you find in pedestal. In an abstracted way, it's also the approach of Javelin |
| 22:56 | ohpauleez | despite all having different engines powering the general mechanism |
| 22:57 | ohpauleez | Shoreleave is the only one built against a protocol, allowing you to swap it out for whatever suits you app the best. The others force the constraint on you, because it's tightly integrated to other pieces of their toolchain |
| 22:57 | ohpauleez | tightly coupled* |
| 22:57 | brehaut | ohpauleez: i saw you mention core.specs on twitter; is that the project you were talking about with types, contracts and generative tests? |
| 22:59 | ohpauleez | yeah, technically the project is called "Sterling" but a component is called core.specs |
| 23:00 | kwertii | I was kind of surprised that nobody mentioned MQ in any of the various streaming event-based stuff presentations |
| 23:00 | brehaut | oh right |
| 23:00 | ohpauleez | the name is only because it re-writes a few contrib libs. And contrib libs can only depend on other contrib libs |
| 23:00 | brehaut | ah interesting |
| 23:01 | ohpauleez | kwertii: I would say most people in this community deploy service-oriented solutions built around MQs |
| 23:01 | kwertii | ohpauleez: oh. great :) |
| 23:01 | ohpauleez | and potentially do some sort of event sourcing // CEP |
| 23:01 | kwertii | but.. like the last clj/w presentation today about gathering profiling data via lamina streams.. apparently uses a custom UDP based protocol. |
| 23:02 | ohpauleez | brehaut: Yeah, the demo was a little weak but essentially - the keywords (:constraints :typed) at the end of the spec are arbitrary. They can be whatever you want them to be, and you register handlers for them |
| 23:02 | ohpauleez | by default, :constraints gets consumed by test,generative and you can also use it to generate a version of your function/record that's constrained by contracts/conditions |
| 23:02 | brehaut | ohpauleez: interesting. i'll have to look at it in more depth when work isnt super busty |
| 23:03 | brehaut | busy |
| 23:03 | ohpauleez | haha, I mean… work being busty isn't so bad |
| 23:04 | ohpauleez | the real power is being Alloy into Clojure - allowing you to run verification on your general *ideas* about the system, in the repl, and have results/feedback in milliseconds |
| 23:04 | ohpauleez | test.generative for your requirements, within milliseconds |
| 23:16 | tyler | ohpauleez: getting ReferenceError: shoreleave is not defined when running rpc function, any ideas? |
| 23:17 | pocho | is using nested atoms a terrible idea? |
| 23:19 | kwertii | pocho: I think so, though I have met an otherwise sane programmer who swears it's a great idea. |
| 23:19 | brehaut | http://c2.com/cgi/wiki?ThreeStarProgrammer |
| 23:20 | brehaut | Two Cabbage Programmer isnt quite as snappy |
| 23:21 | tyler | heh |
| 23:23 | tyler | ah |
| 23:23 | tyler | wrong jar |
| 23:23 | tyler | thanks https://github.com/shoreleave/shoreleave-remote-ring/issues/5 |
| 23:26 | amalloy | brehaut: cabbage? i haven't been following the conversation, but i *have* to hear what that's about |
| 23:26 | brehaut | amalloy: one name for '@' is cabbage |
| 23:27 | amalloy | ah |
| 23:29 | tyler | 2par is my new rap name |
| 23:29 | tyler | (( |
| 23:36 | tyler | bloody hell |
| 23:37 | tyler | updated jar and still is wonky |
| 23:37 | tyler | oh well |
| 23:39 | tyler | aaaaaaaah |
| 23:40 | amalloy | brehaut: i actually have some two-cabbage code |
| 23:40 | tyler | ohpauleez: derp you need to require [shoreleave.remotes.http-rpc :as rpc] even if you're only using macros |
| 23:40 | tyler | i think thats a clojurescript thing require to get access to namespace |
| 23:40 | brehaut | amalloy: what about three? |
| 23:40 | tyler | or is that a clojure thing |
| 23:40 | amalloy | unclear |
| 23:40 | amalloy | i have one place where i store (atom {:key (delay (future ...))}) |
| 23:41 | brehaut | hah |
| 23:41 | brehaut | i think thats at most 2 cabbage |
| 23:44 | ohpauleez | tyler: Yeah, that's a cljs thing |
| 23:44 | ToxicFrog | Now I'm having an issue where, after editing some files, "lein repl", "lein run", and "lein compile" all say "all namespaces already :aot compiled" and my changes don't get picked up until I touch src/* |
| 23:49 | tyler | does pedestal use frp? i couldn't tell when i looked at source |
| 23:53 | Apage43 | pretty sure it's devoid of fiber reinforced plastics |
| 23:53 | amalloy | ToxicFrog: avoid AOT like the plague unless you absolutely must have it |
| 23:53 | amalloy | (and that's quite rare) |
| 23:58 | JeanPierre | amalloy_, I worship his Shadow |