2015-07-01
| 00:00 | sharms | is it possible you declared value in a different namespace? |
| 00:02 | tmtwd | yeah |
| 00:03 | tmtwd | my browser is connected and running the code fine, but as it turns out NO local expressions are available from the repl |
| 00:03 | tmtwd | I didn't realize |
| 00:04 | justin_smith | sharms: glad to hear that worked, yeah it sounded like a reduce to me |
| 00:04 | tmtwd | now that I think about it, I suppose the problem lies somewhere with the repl |
| 00:05 | justin_smith | tmtwd: what namespace was value defined in? |
| 00:05 | tmtwd | reagent-test-app-jun29.core |
| 00:05 | tmtwd | ohhh, |
| 00:06 | justin_smith | tmtwd: why would cljs.user namespace be able to see a value in reagent-test-app-jun29.core ? |
| 00:06 | tmtwd | how do I call into the current namespace in a repl? |
| 00:06 | tmtwd | justin_smith, good point |
| 00:06 | tmtwd | (use current-ns) or something? |
| 00:06 | justin_smith | tmtwd: you don't need to call into the current namespace. It's the one you are in. But you want to require, and optionally switch to, your owhter ns |
| 00:07 | justin_smith | *other |
| 00:07 | tmtwd | justin_smith, from the repl? |
| 00:07 | justin_smith | tmtwd: yes |
| 00:07 | justin_smith | your current ns in the repl is cljs.user |
| 00:07 | justin_smith | so you need to require the code defining your other ns |
| 00:07 | tmtwd | (require reagent-test-app-jun29.core) fails ... |
| 00:08 | justin_smith | tmtwd: it needs to be quoted |
| 00:08 | justin_smith | outside the ns form you need (require '[reagent-test-app-jun29.core :as testapp]) |
| 00:08 | justin_smith | then you can access testapp/value |
| 00:09 | justin_smith | or after that you can use (in-ns 'reagent-test-app-jun29.core) - but make sure the namespace is required / fully loaded before doing that |
| 00:12 | tmtwd | okay lein figwheel is taking forever to start now .... |
| 00:15 | tmtwd | (require "reagent-test-app-jun29.core") |
| 00:15 | tmtwd | clojure.lang.ExceptionInfo: Library name must be specified as a symbol in :require / :require-macros; offending spec: [\e] at line 1 <cljs repl> {:file "<cljs repl>", :line 1, :column 1, :tag :cljs/analysis-error} |
| 00:15 | tmtwd | i get this error now |
| 00:16 | tmtwd | oh well thanks for your help, I'll figure this out later :) |
| 00:16 | tmtwd | go to bed now |
| 00:17 | justin_smith | no, not a string! |
| 00:17 | justin_smith | tmtwd: you want a symbol |
| 00:17 | justin_smith | ,(type 'foo) |
| 00:17 | clojurebot | clojure.lang.Symbol |
| 00:17 | justin_smith | ,(type "foo") |
| 00:17 | clojurebot | java.lang.String |
| 00:18 | justin_smith | TFW you type exactly the thing that would work and they try some other random thing |
| 00:20 | l34ch | (type "foo") |
| 00:20 | l34ch | ,(type "foo") |
| 00:20 | clojurebot | java.lang.String |
| 00:20 | l34ch | ,(println "hi") |
| 00:20 | clojurebot | hi\n |
| 00:21 | l34ch | ,(eror "hi") |
| 00:21 | clojurebot | #error {\n :cause "Unable to resolve symbol: eror in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: eror in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6543]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: eror in this co... |
| 00:21 | l34ch | ,(map inc [1 2 3 4 5]) |
| 00:21 | clojurebot | (2 3 4 5 6) |
| 00:21 | l34ch | ,(map inc (repeat 5)) |
| 00:21 | clojurebot | (6 6 6 6 6 ...) |
| 00:23 | l34ch | ,(loop [x 1] (recur (inc x))) |
| 00:23 | clojurebot | eval service is offline |
| 00:24 | l34ch | ,(:foo {:foo "wow"}) |
| 00:24 | clojurebot | "wow" |
| 00:26 | TEttinger | tmtwd: you want a symbol, as in single quote before a variable-like name, not a string |
| 00:26 | TEttinger | credit to justin_smith |
| 00:26 | TEttinger | (require 'reagent-test-app-jun29.core) |
| 00:27 | tmtwd | ah cool |
| 00:27 | tmtwd | TEttinger, justin_smith thanks |
| 00:27 | TEttinger | (inc justin_smith) |
| 00:27 | lazybot | ⇒ 268 |
| 04:04 | echo-area | Yay! 1.7.0 is released. |
| 04:09 | mmeix | yes, we were witnessing yesterday when puredanger changed the Topic in #clojure to "Currently 1.7" :-) |
| 04:43 | noncom | where's the apropos function? http://dev.clojure.org/jira/browse/CLJ-1191 never saw that, and it is not present in my installation of clojure 1.7.0... |
| 04:44 | noncom | ,(doc apropos) |
| 04:44 | clojurebot | "([str-or-pattern]); Given a regular expression or stringable thing, return a seq of all public definitions in all currently-loaded namespaces that match the str-or-pattern." |
| 04:45 | noncom | here it works, but not in my repl... |
| 04:47 | echo-area | noncom: I see it is in clojure.repl |
| 04:47 | noncom | ah.. |
| 04:50 | noncom | now that i have upgraded to clojure 1.7.0, each time i start a repl, i get a couple of warnings: |
| 04:50 | noncom | ;; Clojure 1.7.0 |
| 04:50 | noncom | Reflection warning, clojure/data/priority_map.clj:215:19 - call to method equiv on java.lang.Object can't be resolved (no such method). |
| 04:50 | noncom | Reflection warning, clojure/core/memoize.clj:72:23 - reference to field cache can't be resolved. |
| 04:50 | noncom | is it normal? |
| 04:50 | noncom | the namespaces that generate these warnings belong to clojure itself... |
| 05:02 | Pupeno | I’m new to Clojure and I want to modify some libraries I’m using. Is this the correct procedure: cloning them from github, running lein install and then just using it normally in my project. Or should I do something different? |
| 05:07 | cfleming | justin_smith: https://github.com/evancz/error-message-catalog is a great idea, similar to what you were thinking about for errors |
| 05:45 | schmir | Pupeno_: this will work. |
| 05:46 | schmir | Pupeno_: but you may like to use a repository manager like nexus in the long run where you host your patched versions |
| 06:01 | Pupeno_ | What's the function that given a sequence gives you another empty sequence of the same type? |
| 06:14 | schmir | ,doc empty |
| 06:14 | clojurebot | #error {\n :cause "Can't take value of a macro: #'clojure.repl/doc"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Can't take value of a macro: #'clojure.repl/doc, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6543]}\n {:type java.lang.RuntimeException\n :message "Can't take value of a macro: #'clojure.... |
| 06:15 | schmir | ,(doc empty) |
| 06:15 | clojurebot | "([coll]); Returns an empty collection of the same category as coll, or nil" |
| 06:25 | tdammers | are there any crucial behind-the-scenes differences between def and let wrt laziness? |
| 06:25 | tdammers | I have this piece of code that relies on varargs being passed as a lazy sequence |
| 06:25 | tdammers | I map apply over that list, and then filter it |
| 06:27 | zphds | Is there a way, I can add a type hint to a compojure route? "/foo/:id", Is there a way I can cast id as a integer somehow? |
| 06:28 | zphds | doing it in a let form myself is a bit cumbersome... Was wondering if there is a better way |
| 06:54 | tdammers | https://gist.github.com/tdammers/e3fc0d2f92c10b8f4d20 |
| 06:54 | tdammers | ^ this is sth that currently baffles me somewhat |
| 06:56 | tdammers | I would expect calling the output of (foo) directly and calling it through a def-bound variable should produce identical behavior |
| 08:44 | justin_smith | cfleming: oh, nice |
| 08:57 | noncom | tdammers: that's interesting |
| 09:01 | tdammers | noncom: we've roughly figured out what's happening by now |
| 09:01 | tdammers | "lazy" doesn't mean "guaranteed to be evaluated as late as possible", it just means "not guaranteed to be evaluated as early as possible" |
| 09:02 | tdammers | and based on those guarantees, clojure seems to use different data structures to represent varargs lists depending on the situation |
| 09:02 | tdammers | and their respective strictness properties bleed into the map and filter calls |
| 09:03 | noncom | tdammers: are you sure? |
| 09:03 | CookedGryphon | Can anyone think of a good reason why clojure's exception throwing (via sneakyThrow perhaps) couldn't capture locals - it would be so ridiculously helpful for debugging, knowing exactly what *data* caused the issue, rather than just the line of code |
| 09:03 | noncom | tdammers: these a bit changed lines show that the functions were processed differently: https://www.refheap.com/104664 |
| 09:03 | justin_smith | ,(apply (fn [[x & _]] x) (range)) ; tdammers is this related to what you are talking about? |
| 09:03 | clojurebot | #error {\n :cause "Java heap space"\n :via\n [{:type java.lang.OutOfMemoryError\n :message "Java heap space"\n :at [java.lang.Long valueOf "Long.java" 577]}]\n :trace\n [[java.lang.Long valueOf "Long.java" 577]\n [clojure.lang.Numbers num "Numbers.java" 1738]\n [clojure.lang.Numbers$LongOps incP "Numbers.java" 552]\n [clojure.lang.Numbers incP "Numbers.java" 116]\n [clojure.core$inc_SINGLE... |
| 09:06 | tdammers | noncom: yes, but does that explain why the first one prints nothing and just returns nil, while calling (blah) prints "NONONO" and returns nil? |
| 09:09 | justin_smith | tdammers: fyi fn always has an implicit do |
| 09:09 | justin_smith | ,((fn [] :a :b :c)) |
| 09:09 | clojurebot | :c |
| 09:09 | tdammers | justin_smith: yeah, keep forgetting that :D |
| 09:13 | tdammers | noncom: some food for thought: https://gist.github.com/tdammers/9e7954f75d6e0aed1220 |
| 09:13 | justin_smith | tdammers: aha! that answers it |
| 09:13 | nikki93_ | how does the compiler differentiate between a ~@ splice in a ` versus a ~ with a @ inside (for a deref)? is the assumption that you don't deref stuff at compile time? |
| 09:14 | justin_smith | tdammers: chunked items are not realized individually - they are realized in groups |
| 09:14 | tdammers | yes, I know |
| 09:14 | tdammers | I just misinterpreted what "lazy" means in this context |
| 09:14 | justin_smith | ,(first (map #(doto % print) (range))) |
| 09:14 | clojurebot | 00 |
| 09:14 | justin_smith | oh! |
| 09:14 | justin_smith | not chunked any more |
| 09:14 | noncom | nikki93_: you would not write ~@my-var to deref a, say, future. you would write @~my-var |
| 09:15 | tdammers | the full laziness that I relied on was an implementation detail |
| 09:15 | justin_smith | ,(first (map #(doto % print) (vec (range 1000)))) |
| 09:15 | clojurebot | 0123456789101112131415161718192021222324252627282930310 |
| 09:15 | nikki93 | sorry my internet is pretty bad. did someone say something |
| 09:15 | noncom | nikki93: you would not write ~@my-var to deref a, say, future. you would write @~my-var |
| 09:15 | noncom | (inside a macro) |
| 09:16 | noncom | so that first you ~ and only then @ |
| 09:16 | noncom | not vice versa |
| 09:16 | nikki93 | hmm |
| 09:16 | noncom | nikki93: see, the full form: (deref ~my-var) |
| 09:16 | noncom | @ is a shortcut for (deref ...) |
| 09:19 | noncom | nikki93: and, btw, that's the reader, not compiler that deciphers the text. so you can look at the reader source and see how things happen there |
| 09:19 | nikki93 | got it |
| 09:22 | noncom | justin_smith: tdammers: so you've figured, that was about laziness not guaranteed? |
| 09:23 | tdammers | noncom: the way I see it, whenever things are documented to be "lazy", then that means I have to take into account that they may not be strict, but I cannot rely on them being fully lazy |
| 09:24 | tdammers | noncom: based on this definition of "lazy", I was relying on implementation-defined behavior, and that behavior changed within the allowed range |
| 09:45 | justin_smith | the definition of "lazy" includes chunking behavior |
| 09:45 | justin_smith | so it is never guaranteed to be maximally lazy |
| 09:46 | justin_smith | if you need to short circuit for correctness, use delays, not laziness (delays can be explicitly forced, and are never implicitly realized) |
| 10:06 | justin_smith | or, you know, a macro like cond or or |
| 10:26 | tmtwd | http://pastebin.com/eN8AESzU how come the second header is displayed on line 7 but not the first header on line 5? (cljs) |
| 10:32 | snowell | tmtwd: You're setting the "value" property of the h1 instead of the content |
| 10:32 | snowell | Try making the {:value @myval} a function call instead of a property map |
| 10:32 | tmtwd | eg? |
| 10:32 | snowell | Er, a deref: [:h1 @myval] |
| 10:33 | tmtwd | snowell, thanks :) working now |
| 10:33 | snowell | np |
| 11:29 | Pupeno | What’s the equivalent of (require ‘(foo.bar)) when declaring a namespace (that is, no alias)? |
| 11:31 | justin_smith | Pupeno: why would declaring a namespace involve an alias of any sort? |
| 11:31 | justin_smith | Pupeno: also, you can do (require 'foo.bar) for that |
| 11:32 | Pupeno | justin_smith: but what's the syntax when passing it to ns? |
| 11:32 | justin_smith | (:require foo.bar) |
| 11:32 | justin_smith | or (:require [foo.bar]) |
| 11:32 | justin_smith | or (:require (foo.bar)) |
| 11:32 | justin_smith | in order of preference |
| 11:33 | Pupeno | Ah... I had a misplaced square bracket. Thanks . |
| 13:36 | amalloy | justin_smith: (:require (foo.bar)) is a no-op, right |
| 13:37 | steffen` | Is there any current guide/tutorial how to get started with clojure and emacs? Which emacs package do I use? SLIME? |
| 13:44 | wasamasa | nope |
| 13:44 | wasamasa | it's CIDER now that they've separated themselves from the CL packages |
| 13:56 | justin_smith | amalloy: he was talking about within the ns form |
| 13:56 | amalloy | justin_smith: right, me too |
| 13:56 | amalloy | () is for prefix lists |
| 13:57 | justin_smith | OK, but in the ns form, that would require the ns wouldn't it? It's terrible, and unidiomatic, but I think it would actually work |
| 13:57 | amalloy | ,(require '(foo.bar.slam.whatever)) |
| 13:57 | clojurebot | nil |
| 13:57 | amalloy | ,(require '[foo.bar.slam.whatever]) |
| 13:57 | clojurebot | #error {\n :cause "Could not locate foo/bar/slam/whatever__init.class or foo/bar/slam/whatever.clj on classpath."\n :via\n [{:type java.io.FileNotFoundException\n :message "Could not locate foo/bar/slam/whatever__init.class or foo/bar/slam/whatever.clj on classpath."\n :at [clojure.lang.RT load "RT.java" 449]}]\n :trace\n [[clojure.lang.RT load "RT.java" 449]\n [clojure.lang.RT load "RT.java"... |
| 13:57 | justin_smith | oh, wow |
| 13:57 | justin_smith | OK, TIL, thanks |
| 13:58 | amalloy | justin_smith: remember, (:require (foo.bar a b c)) requires three namespaces, so (:require (foo.bar)) requires zero |
| 13:58 | justin_smith | ahh... |
| 13:58 | justin_smith | I forgot about that syntax |
| 14:29 | ambrosebs | Bronsa: I'm trying to figure out how tools.analyzer.jvm 0.6.7 decides which method a given host call resolves to. Does it even care about the tags of the arguments? |
| 14:30 | ambrosebs | Bronsa: seems to just pick a random method based on target tag or return type and then forget about it |
| 14:30 | ambrosebs | specifically: how do I figure out which method it will resolve to? |
| 14:32 | Bronsa | ambrosebs: by host call you mean :host-call? |
| 14:32 | ambrosebs | say a :instance-call |
| 14:32 | Bronsa | right, are you asking what is the algorithm t.a.jvm uses to figure out which method to pick? |
| 14:33 | ambrosebs | right, analyze-host-expr seems to not do much picking |
| 14:33 | ambrosebs | like how do you know which overload to pick? |
| 14:34 | Bronsa | ambrosebs: it's done in the validate pass, see validate-call |
| 14:35 | ambrosebs | ah that helps. |
| 14:36 | Bronsa | ambrosebs: it's quite complex and doesn't 100% match the clojure algo, I need to fix that some time |
| 14:36 | ambrosebs | all I want is a function that takes a :instance-call node and returns a clojure.reflect.Method |
| 14:36 | Bronsa | neither algo works 100% of the times, they have different edge cases. |
| 14:36 | Bronsa | ambrosebs: ah, eastwood has that, one sec |
| 14:37 | ambrosebs | core.typed had one but upgrading from 0.3.0 broke it. |
| 14:37 | Bronsa | https://github.com/jonase/eastwood/blob/master/src/eastwood/passes.clj#L11-L91 |
| 14:40 | ambrosebs | Bronsa: also is the best way to skip the `trim` pass to rebind run-passes? |
| 14:40 | ambrosebs | assuming I haven't turned core.typed into a pass in itself |
| 14:41 | Bronsa | yes |
| 14:41 | ambrosebs | cool |
| 14:41 | Bronsa | ambrosebs: do you plan on doing that? turning core.typed into a pass? |
| 14:41 | ambrosebs | yes |
| 14:41 | ambrosebs | 2 passes |
| 14:41 | Bronsa | that's cool |
| 14:42 | ambrosebs | yes :) |
| 14:42 | Bronsa | ambrosebs: not *everything* can be done using the pass scheduler but it should be featureful enough for core.typed |
| 14:43 | ambrosebs | I just want the first pass to run before the second, then have trim run after. |
| 14:44 | ambrosebs | first pass is collect annotations, second is type check |
| 14:44 | rhg135 | c.t as a t.a.j pass sounds cool |
| 14:45 | ambrosebs | right now it's an elaborate library pretending to be something more :P |
| 14:46 | Bronsa | well to be fair it was written before t.a.j was even a thing and the port happened way before t.a had the pass architecture it has now |
| 14:51 | justin_smith | (inc eastwood) |
| 14:51 | justin_smith | andyf_: that tool just keeps saving my ass |
| 14:56 | ambrosebs | Bronsa: is reflect-validated a pass I can give to the scheduler? |
| 14:58 | digiorgi | hi! How can i tell leiningen where is a local project dependency? |
| 14:59 | Bronsa | ambrosebs: yeah just add {:pass-info {:walk :any :depends #{#'validate}}} to the var's meta |
| 15:00 | Bronsa | for whatever reason eastwood doesn't run their custom passes via t.a's scheduler |
| 15:00 | Bronsa | I guess it just never got rewritten |
| 15:03 | snowell1 | digiorgi: :repositories {"local" ~(str (.toURI (java.io.File. "/path/to/your/stuff")))} |
| 15:03 | ambrosebs | Bronsa: is there a pass somewhere to tag each AST with a UUID? |
| 15:03 | ambrosebs | *node |
| 15:04 | Bronsa | I think arrdem might have one |
| 15:04 | snowell | No clue why I was snowell1…I must have gotten caught up in that netsplit earlier |
| 15:05 | Bronsa | ambrosebs: uhm no, doesn't seem like so |
| 15:07 | ambrosebs | cool |
| 15:11 | arrdem | Is there call for such a pass? I've been playing with that exact idea for a while. |
| 15:20 | digiorgi | how can i make the functions in a namespace private? |
| 15:22 | snowell | digiorgi: Use defn- instead of defn |
| 15:23 | arrdem | digiorgi: more generally add the ^:private metadata to your defs. That's what defn- does anyway. |
| 17:13 | nikki93_ | wow the clojure implementation is actually... quite understandable |
| 17:13 | justin_smith | nikki93_: though the indentation in the java files leaves a bit to be desired |
| 17:13 | nikki93_ | yeah it's pretty weird |
| 17:14 | nikki93_ | looking at SyntaxQuoteReader right now while I was reading the clojure programming book |
| 17:14 | nikki93_ | I was like, "wait, it's open source, why don't I just dig in" then jumped to 'read' docs and dug into source :D |
| 17:16 | nikki93_ | it's cool to look at some of the old commmits like "incorporate bigint" |
| 17:21 | wasamasa | I'm still shocked how much more java it is |
| 17:21 | wasamasa | must be its verbosity |
| 17:24 | treelzebub | Joy of Clojure? I'm reading that right now. It's surprisingly entertaining for a programming text :) |
| 18:24 | lvh | Anyone know of issues with clj-http's web server + ring-defaults? I'm seeing https://gist.github.com/lvh/04a7d0aec0db8d47998b |
| 18:24 | lvh | That exception happens before any of my routes are matched against, apparently |
| 18:24 | lvh | it looks like it's trying to call String methods on a keyword, which obv doesn't work |
| 18:25 | lvh | I don't know why I'm getting keyword headers |
| 18:25 | arrdem | lvh: IIRC ring will keywordize at least known headers |
| 18:26 | arrdem | maybe all headers |
| 18:26 | lvh | whaa? but then ring.middleware.content-type is totally broken, right? |
| 18:27 | lvh | oh, wait, hang on |
| 18:27 | lvh | that handles responses, not requests |
| 18:49 | nikki93_ | treelzebub: sorry were you asking me if I was reading Joy of Clojure? |
| 18:58 | treelzebub | nikki93: yeah :) was just curious. i'm really liking it so far |
| 18:58 | nikki93 | ah I was talking about 'clojure programming' earlier |
| 18:58 | nikki93 | but I'm also reading joy of clojure. it's a good 'philosophy' book to read alongside others |
| 18:59 | nikki93 | particularly alongside hickey's talks on state in clojure, and reading about FRP etc. |
| 18:59 | treelzebub | can rarely go wrong by reading an O'Reilly text. i will check it out! |
| 18:59 | treelzebub | yeah, i have also been watching hickey's videos |
| 19:00 | nikki93 | man I wish syntax-quote fixed blah# gensyms to properly do what I mean in nested syntax-quote forms |
| 19:01 | nikki93 | like when you jump 'up and down' syntax-quote levels and use x# |
| 20:27 | zophy | what are they using with eclipse with clojure code ? |
| 20:28 | zophy | i use emacs myself, and web search shows a lot of references to counterclockwise |
| 20:28 | zophy | for eclipse |
| 21:05 | mr_rm | I don't quite understand why if i type this in the repl (http://www.pastebin.ca/3042913) I don't see a new value of @foo print out. Can someone please explain? |
| 21:06 | TEttinger | mr_rm: I think because you're in an infinite loop? |
| 21:06 | TEttinger | whenever you call (forever) , it won't go past that... |
| 21:07 | Bronsa | TEttingermaybe you should wrap forever in a future? |
| 21:07 | mr_rm | TEttinger: however i do get a repl prompt that i can change the atom in |
| 21:07 | Bronsa | err, mr_rm |
| 21:07 | mr_rm | i wasn't sure how the repl was running that loop |
| 21:07 | mr_rm | seems like it's spinning it off on a thread |
| 21:07 | mr_rm | because repl is still active |
| 21:08 | mr_rm | does nrepl create a whole separate process for that? |
| 21:09 | TEttinger | that's an odd one, I wouldn't think that it would still allow input |
| 21:09 | mr_rm | i'm in ccw (eclipse) which let's me continue to type input to the repl while the loop is printing stuff |
| 21:09 | mr_rm | when i tell ccw to stop the loop, the atom is set to the incremented value |
| 21:09 | mr_rm | it's like it's running two separate processes |
| 21:10 | mr_rm | that's why i got confused by it :) |
| 21:11 | TEttinger | I just tried it in lein repl, it does not allow input and just prints "foo = 0" over and over |
| 21:12 | TEttinger | I think telling it to stop the loop happens before the swap! |
| 21:12 | zophy | mr_m while it ios looping and accepting keyboard input can you run other code ? |
| 21:13 | mr_rm | here is the thing... i can't see the output while i keep incrementing the atom (in this case) but when i tell ccw to break, the atom is set to the new value. maybe ccw is batching up the additional input |
| 21:13 | mr_rm | tthen running it all at once after the loop breaks |
| 21:13 | mr_rm | i definitely can keep typing in commands and i see the output from them after breaking the loop |
| 21:14 | mr_rm | i don't see additional java processes. maybe it's just batching it. |
| 21:14 | mr_rm | queueing up the input |
| 21:14 | zophy | how greatly does the atom increment ? |
| 21:15 | mr_rm | as many times as i run (swap! foo inc) while the loop is running |
| 21:15 | zophy | oh, yeah, foo is globali see |
| 21:15 | mr_rm | right |
| 21:16 | zophy | i wonder how that would run not in the repl |
| 21:17 | zophy | i assume it would print everything out, but it would take another program thread to do the swap!, i thinl |
| 21:17 | mr_rm | i inc'd a couple of times, then i did (* 5 5), the new incremented atom values printed out, along with 25, after i broke the loop |
| 21:18 | zophy | repl's are tricky in many ways |
| 21:18 | mr_rm | i actually didn't think it would accept the input at all while the loop was running. figured it was something that i just didn't about but maybe it's normal |
| 21:19 | zophy | but your thread is running :) |
| 21:20 | mr_rm | but the input was just being run on a different thread along with the loop, why isn't the loop thread seeing the changes to the atom? |
| 21:21 | mr_rm | s/^but the/but if the/ |
| 21:21 | zophy | like you said it must be caching the output |
| 21:22 | mr_rm | i think so now. tricky :) |
| 21:22 | zophy | don't know if it's the way java does it's threads or if it's the repl itself doing that |
| 21:23 | mr_rm | must be the repl. java isn't going to magically spin up threads by itself |
| 21:23 | zophy | i've been waiting for a clojure guru to tell us all about this, where are you guru's ? |
| 21:24 | mr_rm | oh wait... the repl is running in a diff process than eclipse with ccw. it's sending my input to the remote nrepl to process and then displays the output. but if the nrepl is busy with that loop, ccw MUST be caching my input |
| 21:24 | mr_rm | that would explain it |
| 21:25 | zophy | i make it a habit to restart my cider repl and test my code without the repl, cider/nrepl isn't very helpful with namespace re-compiling dependencies |
| 21:27 | zophy | all that programmer convience magic is powerful and it takes caution on my part |
| 21:28 | mr_rm | i already used eclipse with java quite a bit (not much lately) so i just tried Counterclockwise (ccw) for Eclipse. it's pretty nice and i have no complaints about it at all. i was just screwing around with this example. |
| 21:28 | zophy | i was going to setup eclipse for myself this evening, never used it |
| 21:31 | mr_rm | there is an nrepl plugin for Atom that i was interested to try but it's very primitive compared to ccw (can only send highlighted text to the nrepl). and as a long time vi user, i found it really hard to get used to the weird key mappings in emacs :) |
| 21:31 | mr_rm | so i stuck with eclipse |
| 21:32 | mr_rm | it really works great but it's kind of a pig, lots of RAM and sometimes will get slow for no apparent reason. |
| 21:38 | zophy | for the way i work, i use either emacs or gvim, i don't really need such a large collaborative structure as an ide like eclispe provides |
| 21:41 | mr_rm | zophy: yeah... we're very enterprisy :) and long ago standardized on maven and eclipse so new devs could immediately jump in and build stuff. it has the maven glue, the repository plugins, plus groovy and java support so i'm used to it anyway |
| 21:42 | mr_rm | i tried using maven for my clojure builds but that was just too painful |
| 21:43 | mr_rm | it worked, and i have some groovy/java/clojure all-in-one sample projects with maven, even using ejbs lol a true mongrel from hell |
| 21:44 | mr_rm | there was more xml config than code |
| 21:50 | justin_smith | mr_rm: code is data! data is code! |
| 21:52 | mr_rm | justin_smith: yes, i did plenty of Ant too, so i know that xml can be code as well! (sure glad those days are over) |
| 21:58 | justin_smith | it was meant to be a dumb lisp joke, but sure, that too |
| 21:59 | mr_rm | yeah, i got it. was going for an equally dumb rejoinder :D |
| 22:00 | justin_smith | as long as we're all dumb |
| 22:00 | mr_rm | lol |
| 22:21 | gfredericks | anybody know how terminals work? I'm wondering why STDIN seems to get things a line at a time, and if that's customizable |
| 22:22 | rpaulo | an empty list evaluates to true in clojure? hmm... |
| 22:22 | gfredericks | rpaulo: yes |
| 22:23 | gfredericks | oh I bet this is exactly what readline is all about eh? |
| 22:24 | rpaulo | gfredericks: is CL the only lisp that evaluates () to false? |
| 22:24 | gfredericks | rpaulo: not sure about scheme |
| 22:24 | rpaulo | scheme is the same as clojure |
| 22:24 | rpaulo | I just tested with s48 |
| 22:25 | gfredericks | rpaulo: lists are a bit less fundamental in clojure; e.g., there are other first-class collections, so for () to be false you'd have to decide if [] and #{} and {} are false as well |
| 22:25 | gfredericks | not to mention all the second-class collections and on and on |
| 22:26 | gfredericks | I don't think readline is my problem |
| 22:29 | amalloy | gfredericks: you need to put your tty in raw mode if you want characters one at a time, i think |
| 22:30 | amalloy | or maybe that is for getting control characters |
| 22:30 | gfredericks | amalloy: is this the part where I finally have to figure out what a tty actually is precisely? |
| 22:30 | amalloy | i still haven't, really. every so often it matters for a brief while and i learn a little bit |
| 22:31 | gfredericks | I think it probably stands for "Terminal, terminal, yeah?" |
| 22:33 | amalloy | well of course it is teletype, since that is what we all use in the modern era |
| 22:44 | justin_smith | amalloy: you type, something happens far away, the latin checks out |
| 23:03 | seangrove | I'm using test.check, and I have gen-english-surnames and gen-japanese-surnames. I'd like to make a generator the will randomly sample from either |
| 23:04 | seangrove | Ah, maybe gen/frequency |
| 23:05 | reiddraper | seangrove: yeah, exactly what you want |
| 23:05 | seangrove | reiddraper: So nice, so nice. |
| 23:05 | seangrove | Sorry I asked, didn't see page 2 until just then |
| 23:08 | reiddraper | seangrove: no problem at all |
| 23:09 | seangrove | Overall really appreciating test.check for lots of different cases |
| 23:09 | seangrove | Wouldn't mind seeing core.typed/test.check/schema all folded into one though |
| 23:09 | seangrove | Or rather, folded into a single notaion |
| 23:09 | seangrove | But I'm sure you've heard that before... |
| 23:12 | reiddraper | seangrove: yeah, no doubt it would be nice in theory, i'm not optimistic it would work in practice though |
| 23:13 | reiddraper | seangrove: gfredericks is working on things more day to day than myself lately, so he can ponder :) |
| 23:13 | seangrove | Heh, fair enough |
| 23:13 | reiddraper | i'm mostly writing haskell now... |
| 23:13 | seangrove | I was just going to ask about QC's ability to do it, actually |
| 23:13 | seangrove | It seems Haskell is able to leverage a lot of the type info |
| 23:14 | seangrove | Why Haskell though? |
| 23:14 | reiddraper | Suppose that's both a simple and a complex question to answer... the short answer is because that's what i'm doing in my job |
| 23:15 | reiddraper | the longer answer will have to wait for another time, i've got to head out, but happy to chat later if you're curious |
| 23:16 | seangrove | Certainly curious, yes, but happy to wait for another time |
| 23:17 | seangrove | So this looks like it's not the way to generate minimum-length strings: (gen/sample (gen/such-that #(> 10 (count %)) gen/string) 100) |
| 23:29 | gfredericks | seangrove: |
| 23:29 | gfredericks | nope |
| 23:29 | gfredericks | have to be careful with such-that |
| 23:31 | gfredericks | seangrove: I don't think we have anything for customizing the sizing of strings, but gen/string is just defined as (gen/fmap clojure.string/join (gen/vector gen/char)) |
| 23:31 | gfredericks | so it's easy to tweak the call to gen/vector to customize its size |
| 23:34 | gfredericks | seangrove: also the schema-gen library can be an okay way to generate generators from schemas |