2014-05-30
| 00:06 | l1x | hi guys |
| 00:07 | l1x | what is the best way of type hinting the return value, i have seen two versions of placing the type |
| 00:07 | l1x | a, right after the defn b, before the param vector |
| 00:08 | l1x | seems both working |
| 00:13 | l1x | i guess it is just a matter of style |
| 00:24 | mange | It seems that putting it on the args vector also lets you hint different arities differently. |
| 00:29 | l1x | yes that is true |
| 00:32 | hellofunk | anyone in here using Heroku? |
| 00:33 | beamso | i have used heroku before |
| 00:33 | ddellacosta | hellofunk: I have used Heroku + Clojure |
| 00:33 | ddellacosta | hellofunk: do you have a related question? |
| 00:33 | hellofunk | I'm trying to figure out the best workflow for development that doesn't involve me having to push to git every little change. |
| 00:33 | hellofunk | Or, |
| 00:34 | beamso | run your app locally using foreman |
| 00:34 | hellofunk | perhaps a way to just do the dev locally without having to tear down and restart the web server |
| 00:34 | hellofunk | if I make a change to a route, it is not reflected even locally unless I stop and restart the lein run process |
| 00:34 | hellofunk | i.e. a reload doesn't do it |
| 00:34 | hellofunk | er, refresh of pahge |
| 00:35 | beamso | using 'lein ring server'? |
| 00:35 | hellofunk | so i'm using the lein run -m option, not advisable? |
| 00:35 | hellofunk | that's in the Heroku tutorials |
| 00:37 | beamso | i use the lein-ring plugin |
| 00:37 | hellofunk | ok let me read up on that |
| 00:38 | beamso | i need to check if it will allow for the changing of a route |
| 00:40 | technomancy | hellofunk: you should do development from a repl |
| 00:40 | technomancy | hellofunk: do `lein new heroku myapp` and work from there; it should pick up changes to your routes on reload |
| 00:41 | technomancy | lein run only makes sense if you won't be making changes |
| 00:41 | beamso | the lein-ring plugin will let you add routes on the fly |
| 00:41 | technomancy | lein-ring doesn't make much sense for heroku deploys |
| 00:42 | beamso | true. i meant for running stuff locally. |
| 00:42 | hellofunk | technomany ideally i'd like to be able to compile the clj source and have it reflected immediately in my running web process. if I have the repl going this would do it? |
| 00:43 | technomancy | hellofunk: definitely |
| 00:43 | hellofunk | is it "lein repl" or "lein run lein repl" as the latter is noted in the Heroku docs, what is the difference? |
| 00:44 | hellofunk | oh sorry, just "lein repl" not "heroku run lein repl" |
| 00:44 | technomancy | you need them both |
| 00:44 | technomancy | one is for local dev and one is for testing things remotely |
| 00:45 | technomancy | (replace lein repl with editor integration if you like; from this perspective they're the same) |
| 00:45 | hellofunk | so for local dev, I do lein repl and it reports this: nREPL server started on port 58360 on host 127.0.0.1 |
| 00:45 | hellofunk | however visiting localhost:58360 does not make a connection |
| 00:46 | technomancy | basically the -main function starts the web server, so once the repl is running, call that function and you're good to go |
| 00:46 | hellofunk | I can connect via emacs fine |
| 00:46 | hellofunk | how do i view the web page I am working on? |
| 00:46 | technomancy | run (-main 5000) |
| 00:47 | hellofunk | technomancy this is typed at a terminal prompt, not a repl? sorry for these newbie confusions |
| 00:47 | Jaood | hellofunk: your open port of 58360 is for the nrepl not the web server |
| 00:48 | technomancy | hellofunk: the -main function of your program should start a web server; if you used the `lein new heroku myapp` template, then it will |
| 00:48 | technomancy | so in a repl you would require your main namespace, switch to it, and run that function |
| 00:49 | hellofunk | ok, let me try |
| 00:54 | hellofunk | so cider doesn't automatically create the repl port, you must do that independently with lein, right? and then use cider to connect to the port lein provides. |
| 00:55 | Jaood | hellofunk: you can connect to a running repl from cider, I usually prefer that |
| 00:56 | hellofunk | ok folks, i got this puppy fed and bathed. it's working and smiling now, ready to be petted. |
| 00:56 | technomancy | hellofunk: cider-jack-in launches a repl server |
| 00:57 | Jaood | err what technomancy said :P |
| 00:58 | hellofunk | technomancy on this type of setup, what is the best way to do a simple password protect on a page similar to a .htaccess on Apache? |
| 01:00 | technomancy | hellofunk: you can write a route or a middleware that checks http basic auth |
| 01:00 | hellofunk | ok |
| 01:00 | hellofunk | similar to how the repl/ works over http? |
| 01:00 | technomancy | yeah you can reuse the same http basic auth stuff for that |
| 01:00 | hellofunk | word! |
| 01:09 | hellofunk | this default heroku template is certainly less intimidating than the compojure template |
| 01:29 | hellofunk | is it possible to put a newline inside a pr or pr-str, etc |
| 01:29 | beamso | ,(pr-str "foo\nbar") |
| 01:29 | clojurebot | "\"foo\\nbar\"" |
| 01:30 | beamso | i need to look at my local docs. don't mind me. |
| 01:34 | hellofunk | beamso no problem i figured out my issue |
| 01:34 | beamso | cool |
| 02:09 | hellofunk | ddellacosta how is your OAuth2 for Friend different than the OAuth2 built into Friend? |
| 02:09 | hellofunk | it came up in a clojars search |
| 02:09 | ddellacosta | hellofunk: there is oauth2 built into friend? |
| 02:09 | hellofunk | http://friend-demo.herokuapp.com/ |
| 02:10 | hellofunk | Well, at least it supports OAuth2 with GitHub, maybe yours does more? |
| 02:10 | ddellacosta | hellofunk: that uses my lib |
| 02:10 | hellofunk | ah, well that explains it |
| 02:11 | ddellacosta | hellofunk: and actually is kind of old, gotta update that and make a PR |
| 02:11 | hellofunk | is OAuth2 basically a competitor of OpenID? |
| 02:11 | ddellacosta | told cemerick I would a while back...d'oh |
| 02:11 | ddellacosta | hellofunk: er, actually no, since OAuth2 is technically an authorization protocol, and OpenID is for authentication |
| 02:11 | hellofunk | I see Google supports both OAuth2 and OpenID |
| 02:12 | ddellacosta | hellofunk: although sadly everyone uses oauth2 as authn these days |
| 02:12 | hellofunk | oh really? is using OpenID (which Friend is mostly providing) a bad idea? |
| 02:13 | dbasch | hellofunk: it’s not a bad idea, it depends on what you’re using it for |
| 02:13 | dbasch | openid can be used in place of a user/password sign-in for a web app, for example |
| 02:13 | hellofunk | I've been tasked with setting a basic page that allows users to login via Google and Facebook |
| 02:13 | dbasch | you can delegate the authentication to google or facebook via openid |
| 02:14 | dbasch | if you need to access google or facebook information on behalf of the user, then that’s what oauth is for |
| 02:14 | ddellacosta | I would argue using openid for authentication is arguably a better idea than using oauth2, since it is actually an authentication protocol by design |
| 02:14 | hellofunk | Friend doesn't explicitly mention Facebook in its OpenID list but FB does not support it |
| 02:14 | hellofunk | sorry, FB *does* support it |
| 02:40 | resolve-this | . |
| 02:56 | luxbock | I'd like to add :source-paths for the dev profile in Leiningen for a project I've already been working on for a while |
| 02:56 | luxbock | is there a lein command/plugin that will create the path/files for me after I add the :source-paths option in my profiles.clj or should I just do it by hand? |
| 03:10 | resolve-this | Hello everyone, I'm having a hard time understanding a weird behavior in parameter metadata. |
| 03:10 | resolve-this | I'm defining a function as (defn my-fn [^{:something #'another-fn} p1 ] ...) |
| 03:10 | resolve-this | When I retrieve p1's metadata by going through something like (-> (meta #'my-fn) (:argslist) (first) (first) (:something)) |
| 03:11 | resolve-this | The result is not #'the-ns/another-fn but "(var another-fn)" of type ......... |
| 03:11 | resolve-this | clojure.lang.Cons! |
| 03:11 | resolve-this | But if I go through this process in the REPL, things work as expected |
| 03:11 | resolve-this | any clues about what am I doing wrong that's causing this? |
| 03:14 | amalloy | metadata on arglists is probably not evaluated, since the arglists themselves aren't evaluated |
| 03:15 | resolve-this | hmmm |
| 03:16 | resolve-this | and it works on the repl because the repl evaluates my var usage? |
| 03:19 | amalloy | i dunno, i don't understand what you're saying about "if i do x it doesn't work, but if i do x in the repl it doesn't" |
| 03:21 | resolve-this | er, what I'm saying is that if I run the code in the repl, it works. |
| 03:21 | resolve-this | but when running in the context of a ring app, that's the behavior I'm getting |
| 03:33 | resolve-this_ | amalloy: anyway, seems like you're right, metadata in parameters does not seem to be evaluated |
| 05:02 | kral | namaste |
| 05:12 | ddellacosta | kral: howdy |
| 05:22 | bob2 | hm, well that was a surprise ending for -social |
| 05:49 | josteink | /msg NickServ identify Maliks41 |
| 05:49 | josteink | well bugget |
| 05:50 | Pandachips | better change that :) |
| 05:50 | josteink | aha |
| 06:07 | kral | ddellacosta: your surname sounds italian :) |
| 06:08 | ddellacosta | kral: it is indeed! I am American but my father's family is originally from Italy. |
| 06:09 | kral | ddellacosta: and you live in Tokyo? :D |
| 06:09 | ddellacosta | kral: yeah, ha, complicated. :-) |
| 06:09 | ddellacosta | kral: you are in Italy? |
| 06:09 | kral | ddellacosta: yep, Vicenza, near Venice. |
| 06:10 | ddellacosta | kral: very nice. I am embarrassed to say I have not yet been to Italy. :-( |
| 06:10 | ddellacosta | kral: it's high on the list though. |
| 06:11 | ddellacosta | kral: would love to know if I still have distant relatives there |
| 06:11 | kral | ddellacosta: della costa is quite a common surname afaik |
| 06:12 | kral | so it's highly possible :) |
| 06:12 | ddellacosta | kral: really? It's quite uncommon in the U.S. But it makes sense that it would be common in Italy, since the meaning seems so general |
| 06:13 | phillord | one of the joys of biology is that you will have distant relative in Italy, and every other country as well! |
| 06:14 | kral | phillord: :) |
| 06:14 | ddellacosta | phillord: haha, very funny. ;-) |
| 06:15 | ddellacosta | phillord: let's say...less distant than in most other countries, and more distant than my relatives in the U.S. |
| 06:15 | kral | ddellacosta: anyway, here is a map of Italy with statistics about "Della Costa": http://bit.ly/1nzPCxu |
| 06:15 | phillord | Finding them may be a little bit more challenging |
| 06:15 | ddellacosta | kral: wow, thanks!! |
| 06:16 | kral | ddellacosta: yw |
| 06:16 | ddellacosta | kral: neat, it has an American map too |
| 06:17 | hellofunk | ddellacosta looking at the source to the Friend demo, I see a lot of ring requests getting destructered against keywords that don't seem to normally be there, like :demo and :context, any idea what that might be? |
| 06:18 | ddellacosta | hellofunk: can you give me a link to a specific line or lines? |
| 06:19 | hellofunk | starting with this: https://github.com/cemerick/friend-demo/blob/master/src/clj/cemerick/friend_demo/openid.clj |
| 06:19 | hellofunk | in the route, it calls functions in this on the request: https://github.com/cemerick/friend-demo/blob/master/src/clj/cemerick/friend_demo/misc.clj |
| 06:20 | hellofunk | here, line 28 forexample https://github.com/cemerick/friend-demo/blob/master/src/clj/cemerick/friend_demo/misc.clj#L28 |
| 06:21 | hellofunk | here's another one where :demo is pulled out: https://github.com/cemerick/friend-demo/blob/master/src/clj/cemerick/friend_demo/misc.clj#L19 |
| 06:21 | cemerick | hellofunk: it's just application metadata, added to all requests here: https://github.com/cemerick/friend-demo/blob/master/src/clj/cemerick/friend_demo.clj#L64 |
| 06:22 | ddellacosta | cemerick, and correct me if I'm wrong, but context is via compojure's context? https://github.com/weavejester/compojure/blob/master/src/compojure/core.clj#L164-L176 |
| 06:22 | cemerick | ddellacosta: correct |
| 06:22 | ddellacosta | hellofunk: ^ |
| 06:22 | hellofunk | interesting |
| 06:24 | hellofunk | this library looks like just what I needed. i assume it's getting its tired kicked nicely in production? |
| 06:24 | hellofunk | *tires |
| 06:44 | ddellacosta | hellofunk: were you talking about friend? I think it's gotten a fair bit of tire kicking |
| 07:31 | noncom | is there a way in clojure for a function to get the outer form of the callsite? |
| 07:32 | noncom | example: https://www.refheap.com/86106 |
| 07:33 | agarman | http://clojure.github.io/clojure/clojure.reflect-api.html |
| 07:34 | noncom | whoa, that's a whole of a lot! |
| 07:34 | agarman | I haven't used that before, so I'm reading through it as well. |
| 07:35 | noncom | i feel like clojure will soon become self-aware |
| 07:42 | agarman | ,(defmacro cur-fn [] `(-> (Throwable.) .getStackTrace first .getClassName) |
| 07:42 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 07:42 | agarman | ,(defmacro cur-fn [] `(-> (Throwable.) .getStackTrace first .getClassName)) |
| 07:42 | clojurebot | #'sandbox/cur-fn |
| 07:42 | agarman | ,(defn foo [] (println (cur-fn))) |
| 07:42 | clojurebot | #'sandbox/foo |
| 07:42 | agarman | (foo) |
| 07:42 | agarman | ,(foo) |
| 07:42 | clojurebot | sandbox$foo\n |
| 07:43 | agarman | that's a horribly performing way to get the name |
| 07:43 | agarman | ,(defn bar [] (println (cur-fn)) |
| 07:43 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 07:43 | agarman | ,(defn bar [] (println (cur-fn))) |
| 07:43 | clojurebot | #'sandbox/bar |
| 07:44 | agarman | ,(bar) |
| 07:44 | clojurebot | sandbox$bar\n |
| 07:51 | lcn | help |
| 07:51 | agarman | lcn: what's up? |
| 07:55 | noncom | agarman: cool :) |
| 07:59 | TimMc | noncom: Is this for a logging fn? |
| 08:00 | noncom | TimMc: yeah, that was the intended use |
| 08:07 | noncom | TimMc: do you maybe have any prososals for that? |
| 08:08 | phillord | Hmm, everytime I try to submit a bug report on core.logic it says "session expires" no matter how long ago I logged in |
| 08:09 | noncom | is it on jira? |
| 08:09 | phillord | yes |
| 08:10 | phillord | well, the bug isn't -- haven't managed to submit it yet:-) |
| 08:10 | phillord | ah |
| 08:10 | phillord | third time lucky |
| 08:10 | noncom | jira - no wonder then |
| 08:10 | noncom | this is just the way it works |
| 08:11 | cab_ | hey folks |
| 08:11 | noncom | you could first file a bug on jira so that they fix this and you be able to file a bug on core.logic |
| 08:11 | noncom | cab_: hey, how is it going? |
| 08:11 | phillord | now I've marked a small issue as major, because that's the default -- ah well |
| 08:12 | TimMc | noncom: Not really any other good ideas, but I do have another hack you can use: If you use a macro and it emits an anonymous fn, that fn's classname includes the enclosing fn's name... |
| 08:12 | Guest6187 | great, I'm dabbling in Clojure using Lighttable |
| 08:12 | TimMc | &(class ((fn some-name [] #()))) |
| 08:12 | lazybot | ⇒ sandbox5671$eval12039$some_name__12040$fn__12041 |
| 08:13 | TimMc | ...which also "looks past" any intervening fn layers. |
| 08:14 | Glenjamin | isn't that essentially the same as using the relfect api in a macro? |
| 08:14 | noncom | TimMc: hah, another neat thing :) |
| 08:14 | Glenjamin | erm, the throwable trick in a macro even |
| 08:14 | Guest6187 | Can I ask you guys a quick question? How do I undef a symbol? I defined a variable named min and shadowed the fn from clojure.core- |
| 08:14 | Glenjamin | ie. it doesn't matter if its slowish because it happens at build time |
| 08:16 | TimMc | Glenjamin: Not quite. What if you had this? (defn top-level [] (map (fn intervening [] (callsite?)) ...)) |
| 08:16 | Glenjamin | ah, i see |
| 08:16 | TimMc | I think callsite? would pick up the intervening fn, but not top-level. |
| 08:16 | Glenjamin | yeah |
| 08:17 | TimMc | noncom: ...but it's even hackier than the stack trace approach. |
| 08:18 | noncom | well, it's a fun challenge to find the hackiest hack hackever! :D |
| 09:46 | TimMc | noncom: (defn toplevel [] (println (:line (meta (def __foo__))))) and then read in the source file and backtrack to the start of the defn form and grab the symbol. |
| 09:47 | TimMc | (Sometimes I scare myself.) |
| 09:48 | TimMc | OK, time for some best practices instead of worst practices. Is there a tool I can use to find all expressions in tail position that match a certain pattern? |
| 09:48 | TimMc | (I'd like to find any place where I'm relying on (log/error ...) to return a nil.) |
| 09:54 | TimMc | Does https://github.com/clojure/tools.analyzer just not have any docs? |
| 09:59 | ambrosebs | TimMc: are you looking for something in particular? |
| 10:02 | TimMc | I was hoping to see a usage example in the README at least, or even better a listing of the basic tools that are provided by the project. |
| 10:02 | TimMc | s/or even better/and\/or/ |
| 10:03 | kandinski | is there anything like (apply f args) but for macros? |
| 10:03 | TimMc | It's less important now; I've realized that looking for tail-position forms is actually a tricky task in and of itself. |
| 10:05 | TimMc | (For instance, I'd want to look for things at the end of catch and finally forms, but also the last form in a try form *before* catch or finally. |
| 10:05 | TimMc | ) |
| 10:06 | mmitchell | anyone know how to tell lein ring uberwar to _not_ include the clojure source files? |
| 10:09 | mmitchell | Ahh, AOT? |
| 10:10 | TimMc | I think that will still include them. |
| 10:10 | TimMc | You might be able to use a filter... |
| 10:11 | ambrosebs | TimMc: sure. You probably want tools.analyzer.jvm. The main entry point is analyze. https://github.com/clojure/tools.analyzer.jvm/blob/master/src/main/clojure/clojure/tools/analyzer/jvm.clj#L446 |
| 10:11 | TimMc | mmitchell: :uberjar-exclusions |
| 10:11 | ambrosebs | play around with at the REPL like: (analyze '(+ 1 2)) |
| 10:11 | TimMc | ambrosebs: Cool, thanks! |
| 10:12 | ambrosebs | but before you start |
| 10:12 | ambrosebs | .. |
| 10:12 | ambrosebs | {:user { :injections [(set! *print-level* 10) (set! *print-length* 10)]}} } |
| 10:13 | ambrosebs | put that in your profiles.clj |
| 10:13 | TimMc | heh |
| 10:13 | ambrosebs | or gradually inspect the output like |
| 10:13 | ambrosebs | (-> (analyze '(+ 1 2)) keys) |
| 10:13 | TimMc | Yeah, that's the kind of stuff I'd like to see in the README. |
| 10:13 | ambrosebs | (-> (analyze '(+ 1 2)) :fn keys) |
| 10:14 | ambrosebs | yea |
| 10:14 | ambrosebs | it's pretty easy to pick up as a consumer |
| 10:14 | TimMc | (I'd write some docs and send a PR, but... yeah.) |
| 10:14 | mmitchell | TimMc: ok thanks, going to try that! |
| 10:14 | TimMc | mmitchell: You might need to add ^:append or something so you don't stomp on the existing values, not sure. |
| 10:14 | gfredericks | TimMc: why don't we have a bot that turns PRs into tickets w/ patches? |
| 10:15 | TimMc | gfredericks: ! |
| 10:15 | gfredericks | and auto-closes them |
| 10:15 | TimMc | Good idea. |
| 10:16 | gfredericks | then the project maintainers can have their own bots that turn tickets+patches into PRs so they can click "merge" |
| 10:16 | TimMc | Bots for everyone! |
| 10:17 | gfredericks | we don't need to argue about what tools we're using; we have computers, we can use whatever we want |
| 10:17 | ambrosebs | TimMc: open a wiki page |
| 10:17 | TimMc | ambrosebs: For now though, this suffices: grep '/((fatal|error|warn|info|debug|trace)f?|logp?)' -P -nr --include=*.clj --color=always -A 3 -B 3 . | less -R |
| 10:18 | TimMc | I don't think the wiki is a good idea. |
| 10:18 | gfredericks | while you smart people are here, I've been thinking about static typie things ever since reading that two year old fight that rhickey had on reddit |
| 10:18 | TimMc | There are very few piecs of documentation that shouldn't be versioned with the code. |
| 10:20 | gfredericks | in particular using the motivating thought that anything I know about the code, I should be able to communicate to the computer; I was wondering whether it would be useful to have some sort of open system of documenting "things I know about the code", for various tools to hook into for the purpose of reasoning/optimizing/whatever |
| 10:21 | gfredericks | such that you could be able to say things about your code without having the burden of needing a guarantee that a tool understands them |
| 10:21 | bbloom | gfredericks: things to say == logical propositions? |
| 10:21 | gfredericks | e.g., I could flag a function as pure, just because I wanted to, and if a type-checker or optimizer or something can take advantage of that, then cool, and if not I can still say it |
| 10:21 | gfredericks | bbloom: yeah |
| 10:22 | gfredericks | I feel like a traditionally understood static type system is more restricted than what I'm imagining |
| 10:22 | bbloom | gfredericks: yeah, what you're describing is related to theorem provers |
| 10:23 | bbloom | in theory, you don't actually need to prove the theorems you've postulated |
| 10:23 | bbloom | er theory is the wrong word |
| 10:23 | bbloom | substitute "i guess you don't actually have to...." |
| 10:24 | bbloom | the big problems here are of motivation, maintenance, usefulness, etc |
| 10:24 | bbloom | even formulating properties to write down, without actually proving them, can be quite difficult |
| 10:24 | gfredericks | at worst it would just serve as documentation for other programmers |
| 10:25 | gfredericks | if it's an open system we don't have to design it correctly up front? |
| 10:25 | bbloom | um, i wouldn't go that far :-P |
| 10:25 | gfredericks | thus my question mark :) |
| 10:26 | gfredericks | s/design it correctly/figure out all the things that can be said/ |
| 10:26 | bbloom | if you have logical propositions, you can't actually do anything useful with them without interpreting them using a particular logic |
| 10:26 | gfredericks | the things you do with them don't have to be strictly formalized; they could turn into warnings, e.g., based on heuristics |
| 10:26 | bbloom | and so if you just kinda ad-hoc make statements & then try to extract value from them later, you're going to get wildly inconsistent value judgements for those propositions as you add/remove/change logical operations |
| 10:27 | bbloom | so there's on going research in to extensible theorem provers and the like |
| 10:27 | bbloom | but you really need to make sure you design the fundamentals well: you need a good strong logic theory with good computational properties |
| 10:28 | gfredericks | I feel like I'm capable of asserting what types my function accepts/returns without answering these questions :) |
| 10:28 | bbloom | if you're interested in this, i suggest you make an attempt to learn Coq or Twelf or one of the other popular theorem provers |
| 10:28 | gfredericks | I'm in the middle of idris |
| 10:29 | hyPiRion | gfredericks: Is that like, the deepest you can go into a programming language? If you're in the middle of the forest, any step you take leads you back out. |
| 10:29 | gfredericks | hyPiRion: yes. |
| 10:30 | gfredericks | s/I'm capable of/I should be capable of/ |
| 10:30 | bbloom | hyPiRion: heh, awesome |
| 10:31 | gfredericks | this is probably the kind of thing ohpauleez was talking about @clojurewest 1.5 years ago isn't it; I missed that talk |
| 10:32 | ohpauleez | my ears are ringing :) hitting the scrollback |
| 10:32 | cbp | ,(System/getProperty "java.version") |
| 10:32 | clojurebot | #<SecurityException java.lang.SecurityException: denied> |
| 10:33 | hyPiRion | gfredericks: maybe? I just did that joke because someone recently told me that I'm currently in the middle of the forest of RRB-trees. |
| 10:33 | ohpauleez | It's pretty close to what I was talking about! |
| 10:34 | ohpauleez | What has me interested in this area lately is Amazon's wide adoption of Lamport's TLA+ for their distributed systems |
| 10:35 | gfredericks | oh that rings a very small bell |
| 10:35 | ohpauleez | In practice, I've seen ROI for capturing just a few subsystems with something like Alloy, and using generative testing for the system as a whole |
| 10:35 | ohpauleez | as you get into distributed systems, that's where the current approaches fall apart |
| 10:35 | gfredericks | I've been using test.check IRL at the integration level a lot lately |
| 10:36 | ohpauleez | TLA+ is potentially one answer, and simulation testing is potentially another |
| 10:36 | ohpauleez | exactly, test.check and test.generative is great at that level |
| 10:36 | gfredericks | test.check wasn't really designed for it; I've had to bend it a bit |
| 10:36 | ohpauleez | Regardless, I still think there's a generic notion of "specification" that can be interpretted, combined, and processed by many systems |
| 10:37 | ohpauleez | I have specs that run in Alloy and core.logic |
| 10:37 | gfredericks | ohpauleez: what sort of API for writing specs? |
| 10:37 | gfredericks | I was imagining just throwing metadata on things |
| 10:39 | ohpauleez | bbloom is right though, specs/assertions/logical invariants are mostly meaningless until you have a larger system to run them. You're either looking at SAT solvers that find missing/invalid cases, or you're looking at time-clock based provers that push the system off of the state machine |
| 10:39 | ohpauleez | gfredericks: The talk at Clojure west used maps to capture specs. An old version is still public: https://github.com/ohpauleez/sterling |
| 10:40 | ohpauleez | https://github.com/ohpauleez/sterling/blob/master/src/sterling/example/filesystem/fs_sterling.clj |
| 10:41 | ohpauleez | there's an example of hitting Alloy (back then, it was still strings), but the API in a privat version matches closely to test.check |
| 10:41 | gfredericks | cool |
| 10:41 | ohpauleez | Here's the full spec as a value: https://github.com/ohpauleez/sterling/blob/master/src/sterling/example.clj |
| 10:41 | ohpauleez | from there you can generate checked versions, contracts, tests, generators, examples, etc |
| 10:41 | ohpauleez | that |
| 10:42 | ohpauleez | that's the power of a (logical) specification |
| 10:43 | ohpauleez | it's a point at which you can derive all other subsystems/results. bbloom and I learned some portions of Z in school. While I understood the math/notation, the system is obtuse and large |
| 10:43 | ohpauleez | I grasped Alloy in a weekend, and in a month could use it effectively |
| 10:43 | bbloom | ohpauleez: i don't recall doing any Z in school |
| 10:43 | ohpauleez | As I said, I'm not digging into TLA+ |
| 10:44 | bbloom | ohpauleez: i never did any theorem proving at all really :-P |
| 10:44 | ohpauleez | bbloom: 202, I think? Req Spec and Validation |
| 10:44 | gfredericks | ooh do we get to accuse people of learning things in school? |
| 10:44 | gfredericks | TimMc and I learned mumps in school |
| 10:44 | bbloom | ohpauleez: maybe? i kinda tuned out my entire computer science education |
| 10:48 | gfredericks | bbloom: ohpauleez: well thanks guys -- knowing that I'm (of course) not being original will help me think about other things :) |
| 10:49 | ohpauleez | gfredericks: Ping me if you want me to take a look at anything, or you're looking for texts. I can certainly help steer you clear of some long dark alleyways |
| 10:49 | ohpauleez | :) |
| 10:50 | gfredericks | ha will do |
| 11:07 | scape | is there a difference between #^ and ^ for hints? |
| 11:08 | cbp | #^ is old and I don't know if it works anymore |
| 11:08 | cbp | it probably does i guess |
| 11:08 | scape | it seems to |
| 11:08 | scape | okay |
| 11:17 | gfredericks | does anybody frequently see (in cider) "Variable binding depth exceeds max-specpdl-size" when trying to eval stuff? |
| 11:21 | ambrosebs | tpope: is it my fault if I :exclude or rebind clojure.core vars that fireplace assumes is in scope? |
| 11:42 | jonasen | gfredericks: i've seen that error. Never really figured out where it came from. Something with the ns form if I'm not mistaken |
| 11:43 | gfredericks | jonasen yeah I got it to work correctly after commenting an (in-ns ...) expression higher up o_O |
| 12:16 | technomancy | gfredericks: max-specpdl-size refers to the stack |
| 12:17 | technomancy | it's just MACLISP-ese for a stack overflow |
| 12:31 | cbp | hrm why is stuff like assert-args private? |
| 12:32 | mmitchell | How can i get "lein ring" to inject servlet-request and servlet-request to the request map? I've seen this before, just can't remember how it's done. |
| 12:32 | arrdem | cbp: because argument validation is lame? |
| 12:33 | cbp | arrdem: that's just like, your opinion man |
| 12:33 | cbp | :-P |
| 12:33 | ohpauleez | cbp: You don't want to use :pre and :post? |
| 12:33 | ohpauleez | are you in an anon function? |
| 12:34 | cbp | ohpauleez: yea |
| 12:35 | ohpauleez | cbp: https://groups.google.com/forum/#!topic/clojure/em68MIYWDjQ |
| 12:36 | ohpauleez | You could always just wallhack it and pull it out into your own util ns, copy-paste, or submit a patch to tools.macro |
| 12:37 | cbp | Oh well, it's not that needed |
| 12:37 | ohpauleez | cool cool |
| 12:41 | ohpauleez | cbp: You still just might do a (def assert-args #'core/assert-args) if you want a quick and dirty way to get at it to get the job done |
| 12:41 | cbp | ohpauleez: yep :-) |
| 12:43 | jcrossley3 | mmitchell: ultimately that happens via ring.util.servlet: https://github.com/ring-clojure/ring/blob/master/ring-servlet/src/ring/util/servlet.clj#L60 |
| 12:43 | jcrossley3 | probably after deploying the result of 'lein ring war' to a servlet container |
| 12:47 | rasmusto | jcrossley3: Tolkien reference? |
| 12:48 | jcrossley3 | rasmusto: sure! :) |
| 12:48 | mmitchell | jcrossley3: ok cool, but how can i get that working locally with "lein ring server"? Do I just need to setup my own function for running an embedded jetty? |
| 12:52 | jcrossley3 | mmitchell: 'lein ring server' runs an embedded jetty but doesn't wrap the handler in a servlet |
| 12:54 | mmitchell | ahh right |
| 12:55 | mmitchell | so i have to wrap my handler somehow? |
| 12:55 | mmitchell | ahh! must be this? https://github.com/ring-clojure/ring/blob/master/ring-servlet/src/ring/util/servlet.clj#L131 |
| 12:55 | jcrossley3 | mmitchell: yes |
| 12:56 | mmitchell | jcrossley3: thanks! |
| 12:56 | jcrossley3 | np |
| 12:59 | benkay | http://lethain.com/a-couple-of-clojure-agent-examples/ << does this really do what it says on the tin, with regards to writing to a single file in a multithreaded context? |
| 13:01 | gfredericks | benkay: I believe so |
| 13:03 | ohpauleez | benkay: I would use mapv instead of those doall maps, if you're going to snag some of the code |
| 13:03 | ohpauleez | and obviously, those anon funcs can just be the function itself |
| 13:03 | ohpauleez | ie: (mapv deref agets) |
| 13:04 | ohpauleez | I also might (def dispatch (comp send-off agent)), and use that instead |
| 13:04 | benkay | thanks, folks |
| 13:15 | featureenvy | Question: I have a vector of points in x y z coordinates (e.g. [1 0 0 3 2 2] where [1 0 0] is one point and [3 2 2] is the other). Now I want to move the points by one in X direction (result should be [2 0 0 4 2 2]). What is the best way to do this in Clojure? |
| 13:17 | dbasch | featureenvy: first off, I would partition 3 your vector into actual points, if you need to treat them as individual things |
| 13:17 | dbasch | ,(partition 3 [1 0 0 3 2 2]) |
| 13:17 | clojurebot | ((1 0 0) (3 2 2)) |
| 13:18 | dbasch | and then map a function that increases the nth coordinate |
| 13:18 | dbasch | but that’s for cleanliness |
| 13:21 | dbasch | e.g. |
| 13:21 | dbasch | ,(map (fn [[x y z]] [(inc x) y z]) '((1 0 0) (3 2 2))) |
| 13:21 | clojurebot | ([2 0 0] [4 2 2]) |
| 13:21 | cbp | I would remodel points too. to be maps {:x .. :y .. :z ..} |
| 13:21 | featureenvy | dbasch: Thanks! I seem to always forget the existance of partition. :) |
| 13:22 | featureenvy | cbp: I thought about that, but in the end I will need them as a single vector again thanks to WebGL. |
| 13:23 | cbp | Nothing wrong with having an interface layer that just turns those maps into vectors imho. |
| 13:26 | featureenvy | In my case I have only one function that generates the points and pushes them directly to WebGL, I won't even touch them anymore. I kinda hope I don't have to add one more indirection. |
| 13:27 | cbp | okies |
| 13:27 | devn | hmmm, this future of programming business sounds interesting |
| 13:27 | devn | (strangeloop session) |
| 13:42 | seancorfield | devn: yeah, some tough choices on the pre-conf stuff |
| 13:43 | seancorfield | my colleague and i went for Powered by JavaScript in the end as being more relevant to our work but several of the workshops look like fun, as well as the Future of Programming day... |
| 13:44 | Glenjamin | i worry with things like powered by javascript what the intended audience is |
| 13:52 | seancorfield | Glenjamin: in what way? |
| 13:52 | seancorfield | I think it's an interesting space - even tho' I despise JS itself |
| 13:53 | whilo | is nikita prokopov from datascript fame here? |
| 13:54 | Glenjamin | seancorfield: in that i'm unsure if its aimed at JS lover, JS haters, beginners, intermediates or advanced users |
| 13:56 | Jabberz | so is H2 still the preferred embedded Java DB of choice for clojure.java.jdbc? |
| 13:57 | Glenjamin | bah, can't decide if i should go to strangeloop |
| 13:57 | Glenjamin | or something more directly work related that doesn't involve travelling to america |
| 13:59 | hiredman | I tend to prefer derby, when I have tried using H2 I always run in to concurrency related issues, h2 seems to default to single threaded use, and I am always too rushed to figure out which all knobs I have to fiddle to get it to not throw exceptions when I try to insert from multiple threads |
| 14:02 | Jabberz | hiredman: ah, thanks for the feedback on that. I notice a lot of examples tend towards sqlite, which I have been burned back in the day on concurrency with as well |
| 14:12 | seancorfield | Glenjamin: I suspect the PbyJS day will have something for everyone on that spectrum :) I'm going because I'm interested in SPAs and we're using ClojureScript / Om at work, and I want to learn more about the ecosystem, even tho' I "hate" JS :) |
| 14:12 | Glenjamin | interesting, maybe i will give it a go then |
| 14:13 | seancorfield | as for traveling to the USA, I can't speak to that - I have never traveled overseas for a conference - but my past two times at Strange Loop have been the best conferences I've attended in a decade or so... |
| 14:13 | Glenjamin | i currently do loads of JS including Node.js at work, and don't mind the language really |
| 14:14 | Glenjamin | if you stick to functions and values its fine, not that many people actually do that |
| 14:18 | wink | Not exactly sure what you would use in a programming language besides functions and values |
| 14:18 | wink | or do you mean objects? :P |
| 14:18 | Glenjamin | yes |
| 14:19 | Glenjamin | and javascript's weird prototype/new/this stuff |
| 14:20 | technomancy | seems like the ecosystem can force your hand in situations like that |
| 14:20 | Glenjamin | to an extent, yeah |
| 14:20 | Glenjamin | the node module ecosystem has been converging on functions and streams, so its not too bad |
| 14:21 | Glenjamin | but often i go into the guts of a lib and its lots of messy heavy-indent long functions |
| 14:33 | Frozenlo` | Oh boy... 'java.io.FileNotFoundException: Could not locate cljs/analyzer__init.class' |
| 14:36 | mmitchell | technomancy: is it possible to override an existing leiningen plugin task with :aliases? I thought this was possible at one point but I can't seem to get it to work now. |
| 14:37 | technomancy | mmitchell: it should work |
| 14:41 | mmitchell | technomancy: ok good. I want to use the "lein ring" plugin, but only the uberwar task. Everyone on our team is already using "lein ring server" to start the dev server, but now we need to customize jetty a bit. So I want to alias "ring server" with my own task. |
| 14:41 | mmitchell | I have this set in my project.clj file :aliases {"ring server" ["run" "-m" "dev-server/start-server"]} -- does that look OK? |
| 14:42 | technomancy | mmitchell: ah, you can't alias subtasks |
| 14:42 | mmitchell | oh i see |
| 14:56 | amalloy | technomancy: presumably it's more accurate to say that you can only alias tasks: "ring" is a task, and "server" is an argument it accepts |
| 14:56 | technomancy | amalloy: this is an also-true superset, yeah |
| 15:06 | erlis | how to debug with emacs cider |
| 15:07 | benkay | any notion on what "clojure.core$agent cannot be cast to clojure.lang.Agent" means? i'm baffled by the $agent terminology |
| 15:07 | erlis | NSA |
| 15:08 | cbp | benkay: maybe you just passed the fn agent where it was expecting an actual agent? |
| 15:08 | cbp | ,agent |
| 15:08 | clojurebot | #<core$agent clojure.core$agent@9e5972> |
| 15:08 | erlis | anyone, how can I debug a function call with emacs cider? |
| 15:08 | erlis | ,debug |
| 15:08 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: debug in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 15:08 | cbp | ,(send agent (fn [])) |
| 15:08 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.core$agent cannot be cast to clojure.lang.Agent> |
| 15:09 | erlis | , (+ 1 2) |
| 15:09 | clojurebot | 3 |
| 15:09 | benkay | cbp: (class *my-agent*) returns clojure.Lang.Agent |
| 15:09 | erlis | wow I didn't know I have a REPL here |
| 15:09 | stuartsierra | benkay: `agent` is a function in Clojure. You're probably using that where you think you have a local variable named `agent`. |
| 15:10 | benkay | yup, thanks stuartsierra |
| 15:14 | amalloy | erlis: the question you're asking is way too vague. just repeating it won't get you a better answer. try explaining what you mean by "debug a function call" |
| 15:15 | erlis | amalloy: I want to see step by step |
| 15:28 | TimMc | erlis: "Debug a function call" could mean many things. |
| 15:31 | erlis | just want to see step by step the execution of a function |
| 15:31 | erlis | with the REPL I can invoke a function and see the result |
| 15:32 | erlis | result is wrong, I would like to see the values step by step, maybe is not possible |
| 15:32 | erlis | I remember someone showed me a library (trace) or similar |
| 15:32 | erlis | probably I can use something like this |
| 15:33 | erlis | hmmmm https://github.com/clojure-emacs/cider-tracing |
| 15:42 | yotsov | erlis: I have heard that it should be possible to put breakpoints in clojure code and use a debugger with counterclockwise. Have not tried it myself. |
| 15:42 | stuartsierra | erlis: True step-by-step debugging in Clojure requires a JVM debugger, which works just fine but will not integrate with CIDER/Emacs. |
| 15:42 | stuartsierra | JSwat is a free JVM debugger known to work with Clojure. |
| 15:43 | erlis | I see, I don't require true step-by-step, but at least visualize, I think I can use the cider-tracing package |
| 15:43 | stuartsierra | There's also tools.trace, https://github.com/clojure/tools.trace |
| 15:44 | erlis | stuartsierra: That can help too thanks! |
| 15:46 | jcromartie | how do I connect to a Leiningen project from Light Table? |
| 15:47 | cbp | ctrl+space -> connect I think |
| 15:47 | jcromartie | From the connection bar, I can select a project.clj, and it does nothing. |
| 15:47 | jcromartie | From a project.clj I can Cmd + Shift + Enter, and it says "Connecting" forever |
| 15:47 | jcromartie | my project is fine |
| 15:48 | jcromartie | latest version of Light Table |
| 15:48 | jcromartie | relatively simple project.clj which can be run by Leiningen just fine |
| 15:48 | Raynes | It's clearly a philosophical message. It's about how we're all going through our lives, trying to connect with other people. |
| 15:48 | Raynes | We are "Connecting..." forever. |
| 15:49 | jcromartie | beautiful |
| 15:49 | arrdem | Raynes: I have some spare glue if you want it... plenty to go around |
| 16:12 | PigDude | what might trigger this reflection warning? "reference to field getPath on java.lang.Object can't be resolved." the line it refers to is a function docstring? |
| 16:14 | rhg135 | hmm |
| 16:14 | dbasch | PigDude: refheap? |
| 16:15 | PigDude | dbasch: https://www.refheap.com/17d783212ba59852473c6bd3f |
| 16:16 | dbasch | PigDude: getPath is a method on File that something must be calling |
| 16:16 | PigDude | oh ok, then it must be coming from cljx? |
| 16:16 | PigDude | it happens earlier in the compilation process than other warnings |
| 16:17 | PigDude | my tests don't touch the filesystem |
| 16:17 | PigDude | (apart from loading clojure code) |
| 16:17 | dbasch | but all those functions look file-y to me |
| 16:18 | PigDude | the log store backend can be file-based, right now it is working with localstorage, in-memory storage, and sql (korma) |
| 16:18 | PigDude | if i were testing a filesystem backend then i might expect that but the code has no io calls right now except for the korma backend |
| 16:19 | dbasch | so is there a getPath somewhere in your core? |
| 16:19 | dbasch | *code? |
| 16:19 | PigDude | not at all |
| 16:20 | PigDude | ah, yea, the message is coming from cljx |
| 16:21 | PigDude | https://github.com/lynaghk/cljx/blob/master/src/cljx/core.clj#L73 |
| 16:22 | PigDude | thanks dbasch |
| 16:22 | dbasch | np |
| 16:34 | arrdem | hum... ideas for testing a code emitter besides just evaling the output and ensuring that the result is the same as clojure.core/eval gives? |
| 16:39 | augustl | arrdem: made me think of Scheme implemented in miniKanren http://2013.flatmap.no/danwill.html :) |
| 16:41 | arrdem | augustl: I mean automated proof that they must eval to equivalent results would be sweet too :P |
| 16:42 | augustl | around 0:45:00 :) |
| 16:43 | arrdem | augustl: I'll check it out in a minute |
| 16:49 | shaun | anyone here use clojurescript router, Secretary? |
| 16:50 | amalloy | ~anyone |
| 16:50 | clojurebot | anyone is anybody |
| 16:50 | amalloy | i hate you, clojurebot |
| 16:50 | augustl | what, you mean there's something that isn't compojure around? :) |
| 16:51 | amalloy | shaun: the point is: whatever your real question is, you don't need to wait for someone to say "yes, i use secretary" before you can ask it |
| 16:52 | shaun | I find client-side routing confusing, not sure how to connect the "secretary/dispatch!" function to the page events |
| 16:52 | shaun | surely I don't need to use goog.History |
| 16:59 | lduros | hi, new to clojure, I just installed leiningen with cider, which shows: CIDER 0.7.0snapshot (package: 20140530.419) (Java 1.7.0_55, Clojure 1.5.1, nREPL 0.2.3) |
| 16:59 | lduros | when I do (1 2 3) looking at clojure in action, I get the following error: |
| 16:59 | lduros | ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn user/eval564 (NO_SOURCE_FILE:1) |
| 17:00 | gfredericks | ,(1 2 3) |
| 17:00 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn> |
| 17:00 | lduros | Isn't (1 2 3) a valid list? |
| 17:00 | gfredericks | ^ it's not just you |
| 17:00 | gfredericks | lduros: sort of |
| 17:00 | lduros | so why is the example in clojure in action showing the following first example: (1 2 3 4) which can contain items of any type |
| 17:00 | hiredman | lduros: it is a list as data, but as code lisp treats lists as function application |
| 17:01 | hiredman | if you don't evaluate it as code, it is a valid list |
| 17:01 | hiredman | ,'(1 2 3 4) |
| 17:01 | clojurebot | (1 2 3 4) |
| 17:01 | lduros | hmm, ok |
| 17:01 | gfredericks | some things in lisp/clojure syntax mean the same thing as code or data -- but other things are treated differently |
| 17:01 | lduros | ok, got it, they are not examples intended to be tried as is, ok |
| 17:19 | l1x | hey guys how can i swap an atom that is a string? |
| 17:20 | dbasch | ,(swap! (atom "") str "hello") |
| 17:20 | clojurebot | "hello" |
| 17:20 | cbp | l1x: wat |
| 17:21 | hiredman | l1x: atoms are atoms, strings are strings, atoms being a refence type can point to or hold a string |
| 17:21 | hiredman | but an atom cannot be a string |
| 17:21 | l1x | dbasch: thanks |
| 17:37 | fifosine | If I have an atom in a web application that is mutated with the swap! function via a post method, how are the changes persisted? Even when I restart my server, I still see the changes. How is this possible? |
| 17:38 | hiredman | fifosine: it isn't, so you aren't seeing what you think you are seeing |
| 17:38 | l1x | dbasch: is there a way to replace the content of an atom instead of keep adding stuff to it? |
| 17:38 | fifosine | hiredman: How am I seeing what I'm seeing? |
| 17:39 | turbofail | l1x: reset! |
| 17:39 | hiredman | fifosine: you aren't, you are seeing something else, most likely I think you aren't actually restarting your server |
| 17:40 | l1x | turbofail: could you shoot me an example? |
| 17:41 | turbofail | ~(let [a (atom 0)] (reset! a "foo") @a) |
| 17:41 | clojurebot | No entiendo |
| 17:41 | fifosine | hiredman: Here's my start and stop server code http://pastebin.com/HK4i98c2, does it look like atoms should reset? |
| 17:41 | turbofail | ,(let [a (atom 0)] (reset! a "foo") @a) |
| 17:41 | clojurebot | "foo" |
| 17:42 | hiredman | fifosine: you aren't actually restarting the jvm |
| 17:42 | hiredman | fifosine: you are restarting some server code running in the jvm, so of the course the atom just stays in memory between runs |
| 17:42 | fifosine | hiredman: Ok, good to know then |
| 17:44 | KeithPM | hello all, is anyone running Session? |
| 17:44 | amalloy | l1x: most of the time if you want to use reset! it's because you're using the atom wrong to begin with. it's not unheard of, but it should be rare |
| 17:46 | l1x | amalloy: ok so what is the best way of rebinding a variable ? just use a closure? |
| 17:47 | arrdem | tbaldridge: you mentioned in your tools.analyzer talk when you demo'd the partial evaluator that you didn't think it would yield any meaningful improvement. is there a reason for that comment or just because your partial wasn't very aggressive? |
| 17:48 | tbaldridge | arrdem: that and the JVM is already insanely good at optimization. So stuff like constant folding is pretty much pointless, the JVM does that already |
| 17:49 | dbasch | l1x: what do you mean by rebinding a variable? you have an atom that points to a value, you can apply an arbitrary function to that value and replace the old value with the result |
| 17:50 | l1x | i just would like to have a while loop and swap the atom by every iteration but instead of keep adding to it i want to replace the content, reset! does that |
| 17:50 | l1x | i was wondering if recur would be better suited for this |
| 17:50 | dbasch | l1x: are you sure you need an atom then? |
| 17:50 | l1x | no, i dont need an atom :) |
| 17:50 | gtrak | l1x: or reduce. |
| 17:51 | arrdem | tbaldridge: mmk. suggestions for an app I could try to load for tree shaking tests? I'm curious how much I'll be able to throw out realistically. |
| 17:53 | tbaldridge | arrdem: you could probably go with just about any library and use an example from it. But to start with you'd probably want something pretty basic... |
| 17:54 | tbaldridge | are you planning to do tree shaking of clojure.core? If so you can probably just do a simple factorial function and confirm that the output of the compiler is just a few calls to clojure.lang.RT |
| 17:56 | arrdem | tbaldridge: yeah I'll shoot for that first. |
| 17:57 | arrdem | tbaldridge: I'm just wondering whether the loading approach I take now will even allow me to analyze the clojure core the way I look at other namespaces. I think I'll have to force oxcart to reload the clojure core for analysis because otherwise it's already loaded in the runtime and the eval/load replacement I provide won't be invoked on it. |
| 18:01 | kliph | is it possible to add a docstring to each arity of a multiple arity defn? |
| 18:01 | arrdem | kliph: no, arities are simply methods and only the containing class has a docstring. |
| 18:01 | hiredman | no |
| 18:01 | kliph | k thanks |
| 18:03 | kliph | so any docstring in the defn would have to describe the multiple arity-ness |
| 18:03 | arrdem | should document all arities, yes. |
| 18:05 | Morgawr | http://jackschaedler.github.io/goya/ just stumbled upon this, it's pretty cool |
| 18:05 | Morgawr | would love to have something like this inside LightTable for example, as a plugin |
| 18:08 | amalloy | kliph: after all, nobody could look up the doc for a particular arity, right? you can't write (doc foo 2) or whatever |
| 18:08 | amalloy | there's only one place to put the docstring, so it all has to go there |
| 18:09 | {blake} | soap-clj...is that what we have for SOAP in Clojure? |
| 18:10 | kliph | amalloy: yeah my next question was going to be, how would I find the docstring for both arities :) |
| 18:11 | dbasch | soap :( |
| 18:12 | {blake} | dbasch, It says so little, and so much... |
| 18:15 | beepbeep_ | Can anyone tell me whats the difference between these two functions? https://gist.github.com/aaronmu/4c025dee6c26b8394c67 |
| 18:16 | beepbeep_ | bottom one doesnt work, cant figure it out :( |
| 18:17 | aperiodic | beepbeep_: the second one could be trying to (apply nil ...), which causes an NPE |
| 18:17 | hiredman | beepbeep_: define "doesn't work" |
| 18:17 | {blake} | So, is it felt that there's nothing to be gained from SOAP, or it's just not a high priority for...anyone...yet. |
| 18:18 | aperiodic | beepbeep_: or possibly message would be unhappy to be handed nil |
| 18:18 | hiredman | aperiodic: he could have run out of heap right there |
| 18:18 | broquaint | {blake}: That was my understanding of things when I last looked. |
| 18:18 | hiredman | aperiodic: his disk could be full |
| 18:18 | hiredman | etc etc etc |
| 18:18 | beepbeep_ | aperiodic an npe is exactly what happens |
| 18:19 | beepbeep_ | I still don't understand why though |
| 18:19 | cbp | ,(apply nil) |
| 18:19 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/apply> |
| 18:19 | hiredman | beepbeep_: pastebin the whole stacktrace |
| 18:19 | aperiodic | hiredman: given that the difference is that method can be nil a lot more easily in the second one, that's probably the issue |
| 18:19 | {blake} | broquaint, lol, which? That there's no point to doing it at all? Or "Well, we'd like to have it but we can get around the lack for now"? |
| 18:19 | arohner | has anyone gotten quil to work w/ an nrepl workflow? when I re-eval the quil namespace, the second sketch window opens up with size 0x0 |
| 18:20 | hiredman | beepbeep_: the stacktrace will tell you where exactly the error happens |
| 18:20 | broquaint | {blake}: The latter :) |
| 18:20 | {blake} | broquaint, thanks! |
| 18:21 | beepbeep_ | hiredman, I'm using LightTable to try out clojure, I'm not getting a stack trace in this case :( |
| 18:21 | dbasch | beepbeep_: the first one fails if both method and message are nil, the second fails if *just* method is nil |
| 18:21 | hiredman | beepbeep_: if lighttable is hiding useful information like stacktraces I would recommend not using it |
| 18:21 | beepbeep_ | hiredman, it usually does not. |
| 18:22 | dbasch | beepbeep_: so you probably have cases in which method is nil but message is not |
| 18:22 | beepbeep_ | okay, I'm gonna try to provide a better paste |
| 18:22 | hiredman | beepbeep_: then it sounds like a bug in lighttable |
| 18:22 | beepbeep_ | because this aint making sense |
| 18:22 | beepbeep_ | gimme a sec :) |
| 18:23 | amalloy | beepbeep_: i mean, the first version figures out which function to call, and then calls it; the second version blindly attempts a call to method even if it doesn't exist |
| 18:23 | beepbeep_ | yeah, I get that |
| 18:23 | beepbeep_ | I'm providing a message |
| 18:23 | beepbeep_ | sec, providing better gist. |
| 18:23 | amalloy | uh huh. that's why it doesn't work. you're trying to call the method instead |
| 18:24 | beepbeep_ | uh-oh |
| 18:24 | beepbeep_ | ofcourse. |
| 18:24 | beepbeep_ | superblind :( |
| 18:25 | arrdem | (doc cond->) |
| 18:25 | clojurebot | "([expr & clauses]); Takes an expression and a set of test/form pairs. Threads expr (via ->) through each form for which the corresponding test expression is true. Note that, unlike cond branching, cond-> threading does not short circuit after the first true test expression." |
| 18:25 | amalloy | but uh, this clojure code looks like you're trying to reinvent ruby. better to leave idioms from an old language behind and figure out how things are done in the one you're learning |
| 18:25 | beepbeep_ | amalloy, that's exactly what it is, well yeah no, I'm reinventing cheap object system like java's. |
| 18:26 | beepbeep_ | it's an exercise |
| 18:26 | beepbeep_ | no worries. |
| 18:26 | beepbeep_ | https://leanpub.com/fp-oo |
| 18:26 | tbaldridge | beepbeep_: if you want a cheap object system, just use deftype |
| 18:26 | amalloy | and my experience re: light table is that most of the time when i hear about it it's when someone says "how come x doesn't work?" "x works fine" "oh well it doesn't work in light table" |
| 18:27 | tbaldridge | (inc amalloy) |
| 18:27 | lazybot | ⇒ 115 |
| 18:27 | tbaldridge | same experience here |
| 18:28 | beepbeep_ | tbaldridge, I'm not actually going to use this, as said, it's an exercise. |
| 18:28 | dbasch | well, light table is still not close to a 1.0 release |
| 18:29 | dbasch | it’s pretty good for what it is but nobody should expect emacs |
| 18:29 | arrdem | dbasch: unfortunately we have emacs and therefore expect the same. |
| 18:29 | arrdem | dbasch: I backed LT and have been consistently disappointed with the beta for exactly that reason. |
| 18:30 | dbasch | arrdem: the instant gratification generation :P |
| 18:30 | amalloy | well, that's silly. don't expect emacs. if you want emacs, just use emacs |
| 18:30 | amalloy | now, i think it's reasonable to expect a clojure evaluator that evaluates clojure correctly |
| 18:30 | cbp | it's been really slow moving lately, i think they switched to this new aurora thing |
| 18:31 | dbasch | amalloy: I’d definitely expect that from something that called itself a 1.0 version |
| 18:32 | beepbeep_ | cbp, yeah, think so too, read some blog posts from author, looks like he's fully going for aurora |
| 18:32 | arrdem | dbasch: it's not that I expect ibdknox to be able to turn out emacs overnight, it's that until LT >= emacs I have no reason to switch. |
| 18:32 | dbasch | arrdem: yeah, and I doubt anyone would switch from emacs to LT anyway |
| 18:33 | arrdem | dbasch: now that I'm entrenched with an erc config and org mode I probably wouldn't anyway, but it'd be nice to have a serious alternative I liked. |
| 18:33 | dbasch | arrdem: LT would be for people who’d laugh at you for using emacs and call you old :) |
| 18:33 | arrdem | dbasch: hey now I need something to make my node_js# classmates shut up about atom :P |
| 18:34 | amalloy | dbasch: you can't just call yourself 0.x and absolve yourself of all expectations. people *paid money* for light table, with an "estimated delivery" of last May. they wanted a clojure environment that's got more bells and whistles than a repl, but it's not even as correct as a repl |
| 18:35 | dbasch | amalloy: technically people backed the project, they didn’t pay for the product |
| 18:35 | dbasch | many people don’t grasp the concept of kickstarter, which is indeed a problem for expectations |
| 18:37 | whodidthis | maybe one day we can have lt repl working on cljs again |
| 18:37 | arrdem | honestly the reason I was interested in LT in the first place was the instarepl and code blocks. for now code blocks have been dropped and were actually a suggested GSoC project (dunno if it got picked up) but I think that some of the "rethinking the editor" stuff that Chris talked about is interesting if and only if editors and IDEs haven't changed a ton in a long time. |
| 18:38 | hipsterslapfight | never try LT with node.js if you think it has clojure problems :v |
| 18:38 | amalloy | dbasch: i mean, kickstarter is supposed to be for things that you can actually produce and just need money for. not things that you kinda hope that if you had some money you could maybe do. for example, the TOS says: Project Creators are required to fulfill all rewards of their successful fundraising campaigns or refund any Backer whose reward they do not or cannot fulfill. |
| 18:39 | amalloy | can he really give you a license to the finished product "light table", if you think a 1.0 should be able to correctly evaluate clojure code, and he does not have a product that can do that? all he can give you is access to a beta that doesn't really work |
| 18:39 | beepbeep_ | well, thanks for the help guys! gn |
| 18:39 | dbasch | amalloy: I agree, and if enough people were unhappy he should issue some refunds |
| 18:39 | dbasch | but clearly it must be good enough for many people who use it and don’t complain |
| 18:40 | whodidthis | inline eval and watches |
| 18:40 | arrdem | that or nobody has actually switched to using it as a primary editor due to frustrations which they haven't bothered to voice in the presence of compelling alternatives like Emacs or Sublime. |
| 18:41 | dbasch | if I had backed it and I wasn’t happy, I’d say it |
| 18:41 | arrdem | which in fairness I doubt given that the mailing list is still active. |
| 18:42 | dbasch | but I normally don’t expect much out of kickstarter stuff, I was just happy to receive my parallela over a year behind schedule |
| 18:43 | tbaldridge | personally I think LT suffers from feature creep. Originally it was just going to be an interactive extensible editor. These days it's a node.js/webkit monstrosity that is trying to "fix programming" |
| 18:44 | arrdem | 2nd system maybe? |
| 18:44 | technomancy | I'm sympathetic to not wanting to build just an editor; much better to make an environment with everything you'd need to build an editor |
| 18:44 | amalloy | dbasch: sure, i haven't backed anything on kickstarter myself. but the thing is, you're *entitled* to expect something, because the TOS says they agree to give you what you paid for. it is not a charity, it is a contract |
| 18:44 | technomancy | that said I have no idea what they're actually doing |
| 18:45 | p_l | tbaldridge: what's worse is how it reacts to certain keys, showing how much it is an embedded build of chrome... |
| 18:45 | technomancy | and browsers are generally huge piles of hacks upon hacks |
| 18:45 | hipsterslapfight | p_l: yeah even atom does a better job of that |
| 18:45 | hipsterslapfight | and with the new react editor atom might become useful |
| 18:46 | p_l | at least they fixed some annoying dependency problem in LT, I didn't have to patch DLLs last time I tried it |
| 18:46 | tbaldridge | when I saw this talk I thought "oh wow, this project is really out in the weeds now..." (http://www.infoq.com/presentations/reimagining-software) |
| 18:47 | tbaldridge | This sort of thing (visual programming) has been tried who knows how many times before and it always ends up in the same place....the weeds |
| 18:48 | technomancy | it works well for teaching kids =) |
| 18:48 | tbaldridge | sure, but it's practically useless for "real" programming :-) |
| 18:50 | {blake} | VAST and Parts worked pretty well. |
| 19:09 | whilo | dnolen_: i think https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/reader.cljs#L547 and https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/reader.cljs#L552 should be declared ^:dynamic (?) |
| 19:10 | whilo | i am rebinding them, which works, but i currently get warnings |
| 19:12 | amalloy | i don't think you should be rebinding them at all, whilo. there's https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/reader.cljs#L567-L579 if you want to add new reader tags |
| 19:13 | whilo | amalloy: i know, but i need a "clean" reader which reads tagged literals as normal clojure datastructures, so i can hash them with sha-1 in a code-agnostic manner |
| 19:13 | whilo | imo it should work like clojure.edn or if i remember correctly tools.reader, which allows to pass in functions for tags and default-case |
| 19:14 | whilo | these two vars are shared mutable state over the whole runtime |
| 19:16 | whilo | i select-keys the default-tags to rebind, which could still break if somebody would register a new tagged reader for #inst for instance: https://github.com/ghubber/hasch/blob/master/src/cljs/hasch/platform.cljs#L16 |
| 19:17 | whilo | it is a bit hacky |
| 19:18 | whilo | this is the corresponding clojure.edn reader: https://github.com/ghubber/hasch/blob/master/src/clj/hasch/platform.clj#L12 |
| 19:19 | amalloy | you want to run md5 against clojure source code literals? what's your plan for things with no guaranteed ordering, like maps? |
| 19:19 | whilo | i padd them, so the hash is the same for commutative datastructures like maps and sets |
| 19:19 | whilo | with xor |
| 19:20 | whilo | https://github.com/ghubber/hasch/blob/master/src/cljx/hasch/benc.cljx#L33 |
| 19:23 | nbeloglazov | arohner, when playing with quil you usually don't reload whole namespace, but rather reload only specific changed functions. For example you modified 'draw' function and you reload only it. This way new window will not be created on each reload |
| 19:24 | whilo | amalloy: not sure about it, i basically need it for cross-platform integrity of data, so i had to do this. if this is complicated or wrong, please point out any flaws |
| 19:33 | lwm | hi folks, has anyone used core.typed and what do they make of it? |
| 19:34 | dbasch | ~anyone |
| 19:34 | 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 ..." |
| 19:34 | cbp | I've heard it becomes unwieldy for large projects and still needs polish |
| 19:35 | dbasch | I’ve seen examples of projects that use it (imo) unnecessarily |
| 19:36 | cbp | dbasch: what kind of projects should use core.typed? |
| 19:37 | dbasch | cbp: the first thing that comes to my mind are things like crypto / security |
| 19:37 | dbasch | but that’s probably just an opinion |
| 19:37 | lwm | projects with people who like type annotations? |
| 19:38 | cbp | you can type annotate in the comments like arrdem :-D |
| 19:38 | technomancy | projects for which the cost of shipping an update is unreasonably high maybe |
| 19:38 | dbasch | I was thinking of cases where you want to pay a significant price upfront to avoid runtime errors |
| 19:38 | cbp | docstrings* |
| 19:38 | dbasch | for things like webapps runtime errors are usually no big deal |
| 19:38 | dbasch | but you wouldn’t want a bitcoin client to blow up in the middle of a transaction |
| 19:39 | lwm | ah, that makes a lot of sense |
| 19:39 | cbp | wouldnt something like quickcheck be a bit better for that? |
| 19:40 | hiredman | I want core.typed to be just another thing that I can use to assist in ensuring the correctness of code, like tests, informal reasoning, etc |
| 19:40 | hiredman | but it still feels too heavy weight to be one tool among many |
| 19:40 | dbasch | I agree with hiredman |
| 19:42 | hiredman | I have been fiddling with an implementation of the raft consensus algorithm, and consensus is something you generally *really* want to work correctly |
| 19:43 | hiredman | I was thinking about annoting it with core.typed, but the cost/benefit seems to high, I would benefit much more from generative testing and using a history checker like knossos |
| 19:45 | lwm | ooh didn't know about 'generative testing' |
| 19:45 | tuft | test.check is great fun |
| 19:45 | lwm | do you think projects run away from dynamic languages like clojure when they can't afford run time errors in their applications? |
| 19:46 | hiredman | are there any projects like that? |
| 19:47 | hiredman | I imagine most projects just go with the skillset they have I guess |
| 19:48 | lwm | well, the bitcoin transaction example above |
| 19:49 | hiredman | yeah, but did that stop people from doing bitcoin websites in php? |
| 19:49 | lwm | ha ... well. a website is one thing |
| 19:50 | lwm | I suppose you are right, skill set and problem domain and all that |
| 19:50 | dbasch | there’s even a heavily used bitcoin library written in js |
| 19:51 | dbasch | and exchanges that were hacked because they used non-transactional databases for transactions |
| 19:51 | tuft | i'm more drawn to prismatic's schema than core.typed |
| 19:51 | tuft | runtime vs static i know, but similar purpose otherwise |
| 19:54 | catern | http://stackoverflow.com/questions/2493996/hidden-features-of-clojure |
| 19:54 | catern | this persistent queue thing, is there a nice way to create it now? |
| 19:54 | catern | nicer* |
| 19:55 | hiredman | nope |
| 19:55 | hiredman | which is too bad |
| 19:55 | hiredman | they are very nice |
| 19:55 | catern | is there a reason? |
| 19:56 | hiredman | http://dev.clojure.org/jira/browse/CLJ-976 |
| 19:56 | technomancy | probably because it's difficult to say "queuefish" with a straight face |
| 19:56 | catern | and, say I want a mutable queue, would the best thing be to put PersistentQueue in an atom? or something else? |
| 19:57 | catern | (or ref or agent or whatever) |
| 19:57 | technomancy | haha; "This needs more time." |
| 19:58 | {blake} | Couldn't you just macro it up, if you wanted it? |
| 19:58 | catern | man, I don't care about read syntax, I just want to write empty-queue instead of what it currently is |
| 19:58 | technomancy | you can't apply patches too quickly or they won't respect you in the morning |
| 19:58 | hiredman | catern: depends what you are doing with it, java.util.concurrent has a number of mutable queues |
| 19:58 | pjstadig | technomancy: it doesn't need more discussion, or design, just time |
| 19:59 | technomancy | pjstadig: like an aged cheese |
| 19:59 | pjstadig | technomancy: a fine wine |
| 19:59 | catern | hiredman: are there nice clojure interfaces to them? |
| 19:59 | catern | nice-looking I mean |
| 19:59 | pjstadig | catern: (ThisIsMyClass. some args) |
| 20:00 | hiredman | catern: interop is nice |
| 20:00 | technomancy | probably there'd be a literal for it if j.u.c. didn't exist |
| 20:00 | technomancy | clojurebot: java.util.concurrent? |
| 20:00 | clojurebot | java.util.concurrent is "When I find myself in times of trouble / Prof. Doug Lea comes to me / Coding lines of wisdom / j.u.c." |
| 20:00 | hiredman | technomancy: nah, they are very different |
| 20:00 | pjstadig | haha |
| 20:00 | pjstadig | clojurebot: nice |
| 20:01 | clojurebot | Excuse me? |
| 20:01 | pjstadig | clojurebot: i said nice |
| 20:01 | clojurebot | Excuse me? |
| 20:01 | technomancy | hiredman: well for better or worse, people would probably use persistent ones when they weren't appropriate if not for juc |
| 20:01 | pjstadig | whatev |
| 20:01 | technomancy | pjstadig: it's pronounced "botsnack" |
| 20:01 | pjstadig | ~botsmack |
| 20:01 | clojurebot | Owww! |
| 20:03 | lwm | haaa clojurebot is winning |
| 20:13 | catern | question, what is the CIDER repl autocompleting when I press tab to get java.util.concurrent.Callable? It doesn't autocomplete java.util.concurrent.LinkedBlockingQueue |
| 20:13 | catern | -doesn't |
| 20:14 | technomancy | it does both for me |
| 20:14 | catern | interesting, any idea what the problem might be? |
| 20:15 | technomancy | I have an older version of cider |
| 20:15 | technomancy | it's not the most stable piece of software |
| 20:29 | kenrestivo | nrepl.el 4evar |
| 20:31 | pjstadig | technomancy: did you fix imenu in the newer version of cider? it's broken in 0.6.0 |
| 20:31 | akurilin | I swear to gosh, every 3 I'm bitten in the ass by ring returning an html file as BufferedInputStream only when making an uberjar |
| 20:31 | akurilin | this is my life's nemesis |
| 20:32 | amalloy | kenrestivo: slime 2010. get on my level |
| 20:32 | kenrestivo | haha, it would take me a *long* time to get on your leve |
| 20:32 | technomancy | pjstadig: still on 0.4.0 |
| 20:32 | p_l | ... jesus, what old versions D: |
| 20:32 | pjstadig | technomancy: it's fixed in master though and your name's all over it |
| 20:33 | technomancy | my name? |
| 20:33 | kenrestivo | huh, 0.1.8 nrepl.el here. works great. :-P |
| 20:33 | pjstadig | git blame |
| 20:33 | technomancy | I haven't touched cider since 2013 |
| 20:33 | technomancy | except for maybe in an experimental branch |
| 20:37 | Bronsa | amalloy: I raise you with a 2009 slime. |
| 20:38 | p_l | ... is that one old enough to be pre-slime-fancy.el? |
| 20:38 | amalloy | nice |
| 20:38 | technomancy | I don't think it's possible to go further back |
| 20:38 | kenrestivo | i wonder if there'll be a market for celebrity endorsements. "cider! used by technomancy!" (insert picture of phil smiling and holding a package of cider) |
| 20:38 | technomancy | oh, nope. swank-clojure started in april of 2008. |
| 20:38 | technomancy | wow |
| 20:38 | p_l | luddites, all of you :D |
| 20:39 | kenrestivo | i'd imagine swank/slime was the first |
| 20:39 | pjstadig | inferior-lisp |
| 20:39 | technomancy | it predates clojure.core |
| 20:40 | amalloy | wait what? |
| 20:40 | amalloy | there's some code in clojure going back to 2006, isn't there? was that all in java? |
| 20:40 | technomancy | (clojure/create-ns 'swank) |
| 20:40 | amalloy | or was clojure around, but too loosely-packed to be put into a namespace |
| 20:40 | pjstadig | oooh it was just clojure back then right? |
| 20:40 | p_l | "2013-11-17" <--- not recently updated slime... |
| 20:40 | amalloy | huh. i had no idea |
| 20:41 | Bronsa | amalloy: I remember a boot.clj rather than core.clj |
| 20:41 | pjstadig | clojure used to compile namespaces differently before you needed at least two segments |
| 20:41 | kenrestivo | i remember rich saying he worked on clojure for 2 years before it was released. i guess that was 2008 |
| 20:41 | amalloy | that i've heard of, Bronsa. i hadn't heard about the namespace "clojure" |
| 20:43 | pjstadig | hey, remember when leiningen used to copy all your dependencies into a 'lib' dir? |
| 20:46 | work_op | anybody familiar with play-clj? getting an error about no class def for openal even though its installed |
| 20:54 | pjstadig | https://github.com/clojure/clojure/commit/3d1daab442b6f6067d5f2fff066bdcee60f9379a |
| 21:08 | technomancy | pjstadig: man those were the days |
| 21:24 | fifosine | To anyone who is familiar with hiccup: what's going on at l16, "[:p user]" in http://pastebin.com/c06hKZP8? I can't figure out what the purpose of this vector is. |
| 21:25 | cbp` | fifosine: a <p> html tag with whatever user is inside |
| 21:26 | fifosine | cbp`: I don't see the p tag in the resulting html page, though. If I change :p to :h1 or if I change user to any string, I see no change in the source. |
| 21:26 | fifosine | So I don't understand what it does |
| 21:27 | cbp` | It's sorrounded by an if-let, if (session/get :user) is nil or false it will not return that vector |
| 21:28 | cbp` | it will return (link-to ..) |
| 21:28 | fifosine | cbp`: Ah! Okay, missed that :p Should I assume that the result of the if-let is conj'd onto content? |
| 21:29 | cbp` | the result of the if-let is passed as a first argument to "base" |
| 21:29 | fifosine | and then content is the second? |
| 21:29 | cbp` | yes |
| 21:29 | fifosine | But function base only takes one argument |
| 21:29 | cbp` | no, it takes any number of arguments , that's what the & means |
| 21:30 | fifosine | Oh! I thought that meant optional parameter |
| 21:30 | fifosine | & means a list of args? |
| 21:30 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: means in this context |
| 21:30 | cbp` | it takes any number of arguments and groups them in a seq called content |
| 21:30 | fifosine | got it |
| 21:30 | fifosine | thanks cbp` |
| 21:30 | cbp` | np |
| 21:35 | Lajjla | cbp`, what is your opinion on the objective-who? |
| 21:57 | jumblemuddle | &(+ 1 1) |
| 21:57 | lazybot | ⇒ 2 |
| 21:57 | jumblemuddle | Wow, I'm impressed. |
| 22:06 | eraserhd | ,(clojure.string/split "\n" #"\n") |
| 22:06 | clojurebot | [] |
| 22:06 | eraserhd | ^^ *sigh* |
| 22:08 | cbp` | eraserhd: ? |
| 23:00 | jumblemuddle | &(println "Hello, World") |
| 23:00 | lazybot | ⇒ Hello, World nil |