Experimental lightweight library for unit-checked math
I have created a *highly experimental* library for unit-checked math. I realize that there are some existing solutions, but I wanted something more lightweight that would layer on top of the existing Clojure/Java numeric system rather than create a new one. This is designed to provide validation in tests rather than to run in production. It has compile-time switching between checked and unchecked operations, and all numbers are still just the regular Java types. This is achieved by storing a mapping of number instances to units; weak references to the number instances are used to avoid creating a memory leak. This does have the disadvantage that units can't be associated with primitives. The API is also designed to facilitate extension to new operations and types. https://github.com/WilliamParker/dimensional-math Any thoughts, suggestions, etc. are welcome. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure needs a web framework with more momentum
Luminus uses a minimal amount of generated code. It completely embraces the composable library approach. The difference from rolling your own each time is that it provides some structure and it's a curated set of libraries that are known to work well together. On Tuesday, May 5, 2015 at 3:46:09 AM UTC-4, Dan Kersten wrote: On Monday, May 4, 2015 at 4:41:02 AM UTC-4, Sven Richter wrote: One potential problem with this web framework as app template approach is upgrade-ability. When 2.0 of your framework comes out, what happens to an app generated from 1.0 that wants to benefit from the new capabilities? This is the reason I don't use Luminus or Modularity or others that rely heavily on leiningen template-based codegen. Its very difficult to upgrade the generated code, especially if you've had to add to or modify it. I'm experimenting with an approach that would generate only the project.clj file and directory structure (putting everything else into libraries), but don't yet have anything to release (my code is currently very targeted at my own use case, but in time I'd like to generalize it a bit and let others at it). -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure needs a web framework with more momentum
One way I could see this working is having a more opinionated profile like +site or something that sets up an app with authentication, logins, a default model and so on. I would definitely support merging the efforts on this front. Ping me by email, and we can try figure out the details. :) On Tuesday, May 5, 2015 at 1:27:21 AM UTC-4, Sven Richter wrote: Hi Dmitri, When I was building closp I was taking luminus as the base for it with some minor adoptions. I just had a look at the website of luminus and saw the massive amount of work you put into the documentation again. If that sounds reasonable for you I'd like to try to move closp and closp-crud to luminus as an opionated part of it. So if you call lein new luminus projectname +closp you will basically get what you get now with closp. You can look here for the additions: https://github.com/sveri/closp. I would like to maintain that branch. I am not sure if that will work out the way I think, but I'd like to evaluate it at least. It would be nice to have a common base and a common documentation for it. Best Regards, Sven Am Dienstag, 5. Mai 2015 02:38:41 UTC+2 schrieb Dmitri: As others have pointed out the comparison isn't really valid. Luminus intentionally aims to leverage existing libraries that are maintained independently whenever possible. I've been doing web dev with Clojure for the past 4 years and overall I do prefer the approach of using composable libraries over monolithic frameworks. With the Clojure web stack it's much easier to tell what's actually happening during the request/response lifecycle as things tend to be explicit. With frameworks like Rails a lot of stuff happens implicitly and requires a lot of in depth knowledge to work with effectively. However, there are a some downsides to the libraries over frameworks approach as well. The biggest issue is that it's difficult to track what libraries are actively maintained and which ones play nicely together. Since most libraries are maintained by individuals it's common for them to become abandoned. Another problem is that each app becomes a unique snowflake since there aren't a lot of established patterns for structuring them. Finally, security is an issue for Clojure web apps as a lot of it done in rather ad hoc fashion. While this works great for people who are well versed in the Clojure web ecosystem it's a huge barrier for newcomers. I think that the best way to address the problem is via organizations where related projects are maintained by groups of contributors. This helps discovery of projects, and it helps spread the burden of maintenance for them. This approach is already working in the wild on GitHub with Ring, Reagent, and Luminus orgs. Meanwhile, Leiningen templates are a great way to provide reasonable defaults for different types of applications and can be used to address issues such as security. Also, I'm certainly open to contributions for Luminus. I moved it to an org recently and new members would be very welcome. :) On Saturday, May 2, 2015 at 4:43:53 PM UTC-4, g vim wrote: I recently did some research into web frameworks on Github. Here's what I found: FRAMEWORK LANG CONTRIBUTORS COMMITS LuminusClojure28678 CaribouClojure 2275 BeegoGolang991522 PhoenixElixir 1241949 YesodHaskell 1303722 LaravelPHP2684421 PlayScala 4176085 SymfonyPHP113020914 RailsRuby 269151000 One could conclude from this that the Clojure community isn't that interested in web development but the last Clojure survey suggests otherwise. Clojure's library composition approach to everything only goes so far with large web applications, as Aaron Bedra reminded us in March last year: www.youtube.com/watch?v=CBL59w7fXw4 . Less manpower means less momentum and more bugs. Furthermore, I have a hunch that Clojure's poor adoption as indicated by Indeed.com maybe due to this immaturity in the web framework sphere. Why is it that Elixir, with a much smaller community and lifespan than Clojure's, has managed to put 4 times as much mindshare into its main web framework when its module output, as measured by modulecounts.com, is a tiny fraction of Clojure's? gvim -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: A more flexible versio of - ?
I really like: https://github.com/jdevuyst/fletching-macros It's nice because you can use it with plain arrows... as little exceptions. On Tuesday, May 5, 2015 at 4:09:55 AM UTC+2, Frank Siler wrote: On May 4, 2015, at 1546, Kaiyin Zhong kindl...@gmail.com javascript: wrote: Wouldn't be nice to have something like: See also Swiss Arrows: https://github.com/rplevy/swiss-arrows Great article on “hard to Google” forms in Clojure: https://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/ Frank` -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Metadata loss. What am I doing wrong?
The Eastwood [1] Clojure lint tool has a few warnings in it that warn about unused metadata in your code. The :unused-meta-on-macro warns about metadata on macro invocations, which is usually ignored by Clojure [2]. The :wrong-tag warns about unused type tag metadata on Vars, and non-fully-qualified Java class names on arg vectors [3]. Andy [1] https://github.com/jonase/eastwood [2] https://github.com/jonase/eastwood#unused-meta-on-macro [3] https://github.com/jonase/eastwood#wrong-tag On Tue, May 5, 2015 at 5:51 PM, Mike Rodriguez mjr4...@gmail.com wrote: What you wanted here was (meta '^:abc some-symbol) It's a little weird but the reader attaches the metadata to the symbol. Then the quote just evaluates directly to the same symbol, so the metadata is preserved. I agree that metadata can be confusing though. Especially around where AND HOW you put the metadata for a functions return value(s). See [1] for more on that confusing track... Also there are plenty of subtle gotchas to macros etc that do not preserve metadata. 'clojure.core/or' is a good example of that. A search for Clojure preserve metadata will likely turn up a good list of Jiras out there to fix areas that do not preserve metadata as expected. Looks like there are some tips at [2]. [1] http://dev.clojure.org/jira/browse/CLJ-1232 [2] http://stackoverflow.com/questions/4673011/what-functions-in-clojure-core-preserve-meta -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Streaming a big file
On Tuesday, May 5, 2015 at 11:18:56 PM UTC-4, Sam Raker wrote: I've got two really big CSV files that I need to compare. Stay tuned for the semi-inevitable how do I optimize over this M x N space? question, but for now I'm still trying to get the data into a reasonable format--I'm planning on converting each line into a map, with keys coming from either the first line of the file, or a separate list I was given. Non-lazy approaches run into memory limitations; lazy approaches run into Stream closed exceptions while trying to coordinate `with-open` and `line-seq`. Given that memory is already tight, I'd like to avoid leaving open files/file descriptors/readers/whatever-the-term-in-clojure-is lying around. I've tried writing a macro, I've tried transducers, I've tried passing around the open reader along with the lazy seq, none successfully, albeit none necessarily particularly well. Any suggestions on streaming such big files? Something like this didn't work? (with-open [rdr1 ... rdr2 ...] (let [l1 (line-seq rdr1) l2 (line-seq rdr2)] (- (map something l1 l2) (filter whatever) (first For instance, to check if two text files are the same, something would be not= and whatever would be identity, and the result would be nil if they were the same, and something truthy otherwise. The first has the effect of short circuiting when the result is known, and neither line-seq's head should be held. The first also has the effect of ensuring the with-open scope is not left until as much of both line-seqs are consumed as will be needed. Reduce and the use of trans/reducers that get reduced would have the same effect. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Testing strategies for cljc files
You will have to import cljs.test and clojure.test conditionally for the respective platforms. Their APIs are very similar. Some conditionals might have to be added, depending on your use. On Wednesday, May 6, 2015 at 12:12:51 AM UTC+2, Daniel Compton wrote: I'm wanting to migrate some files to cljc so a library can be used in Clojure and ClojureScript. I want to be able to run the same test suite against the Clojure and ClojureScript versions. What is the testing story for cljc files? If I made my test files cljc files as well, could I run clojure.test and clojurescript.test against the same test files? Or is there another more appropriate way of doing this? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Dynamic/Convention-based routing libraries? (was: Clojure needs a web framework with more momentum
Cool Idea! Convention based routing is a great way to get started quickly and I think that it actually might make a lot of people, asking for clojure frameworks, happy. I'm not aware of any clojure lib that does that, but I'd like to speculate a bit on what it might mean: As it happens, when I hear 'convention based routing', I think of mapping web paths to file system paths, the way most web servers do, where resource variants and/or behavior are configured by path patterns (most often by suffix a'la *.php). A lot could be said about the merit of letting people use just their file browser to set up even moderately complex web apps, but of course there are also downsides: This approach leads to components being scattered over multiple files, where n files would need to be renamed to rename a single resource. Also it probably won't interact well with java's classpath loading, so a leiningen plugin would be needed to index the app before packaging. Still, for accessibility, I'd put my money on automatic file-system-path mapping, rather than method mapping or source annotations. detour At this point, I'd like to honorably mention the nix programming language, where the idiomatic way to define a module is to define a file like this: {dep1, dep2}: implementation ... That is a file, containing a nix function with a single parameter `param: body`, where the parameter is destructured. This function can be loaded as is, by `import ./file.nix`. It can by auto-called with its dependencies by `pkgs.callPackage ./file.nix {/*dep-overrides*/}`, thus, the package instantiated (yes, callPackage discovers the needed dependency symbols and takes them from pkgs, with optional overrides). This makes it easy and idiomatic to work with file-mapping, while not even needing namespaces or top-level names. Maybe something like that could be done to sneak clojure behavior into static file serving? /detour What do you think? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
how goeth the STM experiment?
hi, What do people think of STM after all these years? What pros vs. cons are there - has the community evolved the list of them? thanks for any thoughts. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Metadata loss. What am I doing wrong?
+1 to Eastwood. It is great. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Metadata loss. What am I doing wrong?
What you wanted here was (meta '^:abc some-symbol) It's a little weird but the reader attaches the metadata to the symbol. Then the quote just evaluates directly to the same symbol, so the metadata is preserved. I agree that metadata can be confusing though. Especially around where AND HOW you put the metadata for a functions return value(s). See [1] for more on that confusing track... Also there are plenty of subtle gotchas to macros etc that do not preserve metadata. 'clojure.core/or' is a good example of that. A search for Clojure preserve metadata will likely turn up a good list of Jiras out there to fix areas that do not preserve metadata as expected. Looks like there are some tips at [2]. [1] http://dev.clojure.org/jira/browse/CLJ-1232 [2] http://stackoverflow.com/questions/4673011/what-functions-in-clojure-core-preserve-meta -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Dynamic/Convention-based routing libraries? (was: Clojure needs a web framework with more momentum
Hi Sean, Pedestal's router is just an interceptor in the chain. You could easily write an interceptor that looks at the request and sees if it can resolve a var by that name. You could even stack multiple routers - first the var/fn lookup and failing that, a more explicit router. Cheers, Paul -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Metadata loss. What am I doing wrong?
From your comments, I suspect this may be a source of confusion as well: When you have something like (defn ^{:doc Increments} a-fn [x] (+ x 1)) the metadata is attached to the symbol at read time. However, during the compilation process, the metadata on the symbol is transferred to the Var that holds the function created. If you want to access this metadata you have to access the Var itself, not the function. user= (meta a-fn) nil user= (meta #'a-fn) {:ns #Namespace user, :name a-fn, :file NO_SOURCE_PATH, :column 1, :line 1, :arglists ([x]), :doc Increments} The #' syntax is shorthand for accessing the Var. You can see this process in the following code: (let [fn-def-sym (with-meta 'b-fn {:here true}) fn-def-code `(defn ~fn-def-sym [x#] (+ x# 1))] (eval fn-def-code)) #'user/b-fn user= (b-fn 2) 3 user= (meta b-fn) nil user= (meta #'b-fn) {:ns #Namespace user, :name b-fn, :file NO_SOURCE_PATH, :here true, :column 1, :line 1, :arglists ([x__769__auto__])} The important thing here is that the definition code is manually built up using a symbol that has metadata given manually, which is then transferred to a Var when the code is evaluated. On Tuesday, May 5, 2015 at 1:31:40 PM UTC-5, Andrey Antukh wrote: Hi! I have some trouble with clojure metadata / reader and I do not know if I'm doing something wrong. I have this code: (defn some-func []) (def func ^:abc some-func) (assert (= (meta func) {:abc true})) (def data [[:bar (with-meta some-func {:abc true})] [:baz ^:abc some-func]]) (assert (= (meta (get-in data [0 1])) {:abc true})) (assert (= (meta (get-in data [1 1])) {:abc true})) It fails in the first assert and in the last (if I comment the first one obviously). I do not understand why that form of metadata does not works as I expect (http://clojure.org/metadata) Thank you very much. Regards. Andrey -- Andrey Antukh - Андрей Антух - andrei@kaleidos.net javascript: / ni...@niwi.be javascript: http://www.niwi.be http://www.niwi.be/page/about/ https://github.com/niwibe -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ANN, GSoC] A Common Clojure Source Metadata Model
Am Mittwoch, 6. Mai 2015 07:17:54 UTC+9 schrieb kovasb: I'm mostly interested in something like http://docs.racket-lang.org/scribble/ Thanks for the idea! There is http://clojure-scribble.publicfields.net/, which you might know already. Maybe something like that could also be integrated with the output of my project. But let me clarify again, because maybe this hasn't come across clearly enough: my project is not about creating another tool for generating documentation pages. Rather, I want to think about what aspects of Clojure code describe how to use a namespace. That's vars, records etc. along with their doc strings, argument lists etc. and positional information. I have to think how these can be captured and then output as data in various ways. That could be storing in Datomic, deploying to Clojars and so on. Other tools can then use these data for their purposes like building documentation pages or recording the evolution of the API like Codeq. @Alex Miller: If I'm mangling your ideas, please correct me! Richard -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Metadata loss. What am I doing wrong?
In reference to [1]: I do feel like the metadata loss on many macros is undesirable though and I wish it were addressed. It certainly feels unhygienic, just in a new sense of the term. [1] https://github.com/jonase/eastwood#unused-meta-on-macro -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Dynamic/Convention-based routing libraries? (was: Clojure needs a web framework with more momentum
On May 5, 2015, at 6:30 PM, Herwig Hochleitner hhochleit...@gmail.com wrote: Cool Idea! Convention based routing is a great way to get started quickly and I think that it actually might make a lot of people, asking for clojure frameworks, happy. I'm not aware of any clojure lib that does that, but I'd like to speculate a bit on what it might mean: As it happens, when I hear 'convention based routing', I think of mapping web paths to file system paths, the way most web servers do, where resource variants and/or behavior are configured by path patterns (most often by suffix a'la *.php). A lot could be said about the merit of letting people use just their file browser to set up even moderately complex web apps, but of course there are also downsides: This approach leads to components being scattered over multiple files, where n files would need to be renamed to rename a single resource. Also it probably won't interact well with java's classpath loading, so a leiningen plugin would be needed to index the app before packaging. Yup, arbitrary URL-to-file system mapping is often horrible. Here’s how FW/1 works: * A request comes in for /foo/bar * FW/1 attempts to require {appname}.controllers.foo * If that succeeds, FW/1 attempts to resolve {appname}.controllers.foo/bar as a symbol * If that succeeds, that function is called as a handler for the current request Only public functions in existing namespaces in the /{appname}/controllers folder will resolve to match inbound requests. FW/1 locates views and a cascade of optional layout wrappers via convention too. There are also before and after extension points for pre- and post-processing to occur application-wide and/or per-controller. You can also specify some explicit routes that should map differently (basic but standard routing with :name style placeholders — explicit routes are currently undocumented as they’re a work-in-progress). A simple user manager example is here: https://github.com/framework-one/fw1-clj/tree/master/examples/usermanager https://github.com/framework-one/fw1-clj/tree/master/examples/usermanager As indicated in the original thread, a lot of people have built substantial production apps with FW/1 in its original language. It’s hit a particular sweet spot for a lot of people in being really easy to get up and running with, but useful enough to build serious business apps. Right now, no one is using this Clojure port (except me, mostly for fun). That’s why I haven’t promoted it here (beyond a few passing mentions). There’s a Leiningen template: lein new fw1 tryme cd tryme PORT=8321 lein run go to http://localhost:8321/ Sean Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Streaming a big file
I've got two really big CSV files that I need to compare. Stay tuned for the semi-inevitable how do I optimize over this M x N space? question, but for now I'm still trying to get the data into a reasonable format--I'm planning on converting each line into a map, with keys coming from either the first line of the file, or a separate list I was given. Non-lazy approaches run into memory limitations; lazy approaches run into Stream closed exceptions while trying to coordinate `with-open` and `line-seq`. Given that memory is already tight, I'd like to avoid leaving open files/file descriptors/readers/whatever-the-term-in-clojure-is lying around. I've tried writing a macro, I've tried transducers, I've tried passing around the open reader along with the lazy seq, none successfully, albeit none necessarily particularly well. Any suggestions on streaming such big files? Thanks! -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure needs a web framework with more momentum
Maybe I don't entirely understand what a web framework is, but it seems to me like Immutant is an example of something that might fit into a lot of the buckets. Could someone explain how that isn't the case? Thanks, -- Morgon -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Dynamic/Convention-based routing libraries? (was: Clojure needs a web framework with more momentum
Perhaps I should rephrase that as a request for simple, convention-based routing that works with Ring directly? :) I’m sure Pedestal’s great, but just looking at the repo and documentation doesn’t exactly scream simple… I just don’t want to have to read that much documentation to get a simple web app up and running. Sean On May 5, 2015, at 4:45 PM, Paul deGrandis paul.degran...@gmail.com wrote: Pedestal's router is just an interceptor in the chain. You could easily write an interceptor that looks at the request and sees if it can resolve a var by that name. You could even stack multiple routers - first the var/fn lookup and failing that, a more explicit router. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Adding components to a stuartsierra/component system at runtime
You can work with two systems. The first system connects to the database. Once you have started it, you can use it to create the second system. Then you start the second system. The code for this can be wrapped in a single component. On Sunday, May 3, 2015 at 12:02:00 AM UTC+2, Chap Lovejoy wrote: Hi, I'm building a system which handles data synchronization with remote services. The credentials and configuration parameters for the remote services are stored in the database. I'd like to be able to build a component which is constructed from the information from the database and uses component to resolve the dependencies for other components in the system (s3, etc). Is there a mechanism for either adding components to a system at runtime or resolving the dependencies for a component which can then be stored as part of the state of another? Thanks, Chap -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Streaming a big file
I wrote a library ( https://github.com/thebusby/iota ) to handle a very similar issue, which I hope would be of some help to you here. On Wed, May 6, 2015 at 12:18 PM, Sam Raker sam.ra...@gmail.com wrote: I've got two really big CSV files that I need to compare. Stay tuned for the semi-inevitable how do I optimize over this M x N space? question, but for now I'm still trying to get the data into a reasonable format--I'm planning on converting each line into a map, with keys coming from either the first line of the file, or a separate list I was given. Non-lazy approaches run into memory limitations; lazy approaches run into Stream closed exceptions while trying to coordinate `with-open` and `line-seq`. Given that memory is already tight, I'd like to avoid leaving open files/file descriptors/readers/whatever-the-term-in-clojure-is lying around. I've tried writing a macro, I've tried transducers, I've tried passing around the open reader along with the lazy seq, none successfully, albeit none necessarily particularly well. Any suggestions on streaming such big files? Thanks! -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Dynamic/Convention-based routing libraries? (was: Clojure needs a web framework with more momentum
Routes-as-data routing libraries, such Bidi or (I know... complicated...) Pedestal, should be able to (fairly) easily create abstractions that permit convention-based routing. It's not exactly what you're talking about, but I made a little toy example of how you could mimic Rails resource routing on top of Gate. https://github.com/mischov/gate/blob/master/examples/gate/examples/crud_example.clj On Tuesday, May 5, 2015 at 6:53:14 PM UTC-5, Sean Corfield wrote: Perhaps I should rephrase that as a request for simple, convention-based routing that works with Ring directly? :) I’m sure Pedestal’s great, but just looking at the repo and documentation doesn’t exactly scream simple… I just don’t want to have to read that much documentation to get a simple web app up and running. Sean On May 5, 2015, at 4:45 PM, Paul deGrandis paul.de...@gmail.com javascript: wrote: Pedestal's router is just an interceptor in the chain. You could easily write an interceptor that looks at the request and sees if it can resolve a var by that name. You could even stack multiple routers - first the var/fn lookup and failing that, a more explicit router. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Adding components to a stuartsierra/component system at runtime
Stuart, Leon, Thank you for the follow ups. I ended up doing as Leon described and creating several subsystems for each remote connection and injecting the required dependencies from the top-level system. I have a component that manages creating the subsystems and dealing with stopping them without stopping the resources from the enclosing system. It seems to be working well so far. Thanks again, Chap -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure needs a web framework with more momentum
Wow, what a thread! As one of the authors and designers of Caribou, I have a couple of clarifications to offer. When the initial post compared contributors and commits, it picked our caribou repo, which, while extensive, holds no code, only our docs. The actual code is in caribou-core (persistence layer via edn abstraction), polaris (routing via edn data structures), caribou-api (rest api to caribou-core), antlers (an extended edn friendly mustache for templating), lichen (automated caching image resizer with optional s3 integration and stand alone http server), schmetterling (web ui for debugging exceptions, with in frame evaluation and locals display), caribou-frontend (pulling together core, antler, lichen, polaris and ring to make a site), and caribou-admin (crud ui for caribou-core models, including a drag and drop ui to define routes that can be imported by polaris). Caribou is not abandoned, though it did lose funding. I currently use core plus polaris without the other components at my day job, though working on Caribou itself is not strictly in scope for my salaried work. Which is to say, Caribou is very much a modular framework ( though much of it does rely on the caribou-core persistence abstraction). It's imperfect but useful, and work is slowed but not abandoned. I'm always always in #caribou on freenode, and we have extensive docs. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Embedded systems and transpiling Clojure to Nim
I'm just going to echo a few things - Timothy and I have talked at length about Clojure-like languages on other platforms. His ideas and general approach have led to some very promising work (Pixie), and I can personally vouch for RPython as a platform. My ideas led me to Terra ( http://terralang.org ) - which supports LLVM-based compilation (AOT and JIT), dynamic typing/programming via LuaJit integration, macros and AST manipulation, etc. Based on this and some needs I was trying to fill, I produced cljs-terra ( https://github.com/ohpauleez/cljs-terra ). The trade-off is the that library support is a mix of Lua and C libs all intertwined. There is also the option of ClojureScript on top of Node.js (which I recently used for an IoT system) - which has an ecosystem of libraries. All of that aside, I still tend to do my low-level work in C and C++14, with some Lua and Terra occasionally. I also recently used Oracle's Embedded JVM with great success (producing a custom JRE for exactly what I needed). Cheers, Paul -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure needs a web framework with more momentum
Colin's response is spot on. The Clojure ecosystem is a lot of fun, and is really good for solving complex problems, but I think it falls short for handling things that have already been solved in other less technically interesting ecosystems. Shopping carts and payment gateway integration, as he mentioned, are two obvious ones; anything related to customer relationship management is another category, i.e. mailing list management. Probably in these cases, it would be better to just go with the existing less elegant (technology-wise) solutions, including content management systems like WordPress, Joomla, or Drupal. In fact, it would be worthwhile to go through their plug-in pages to categorize what types of problems and solutions are provided for CMS type systems. Just be sure to wear tall boots if you have to wade into the PHP :-) On Sunday, May 3, 2015 at 1:21:31 AM UTC-5, Colin Fleming wrote: Because, in my case, I'm going to need a website shortly that I can use to sell Cursive. I'd really like to use Clojure for that. I could use Rails or Django which would make the site itself trivial, except I don't know either of them and then I'm stuck maintaining something in a language and framework I have no interest in and don't understand how to deploy or maintain. Or I could do it in Clojure which means that I understand the libraries, frameworks, deployment and monitoring inside and out, except I now have to implement a shopping cart and integrations with payments gateways etc. Neither of these are great options for me. On 3 May 2015 at 16:24, Sean Corfield se...@corfield.org javascript: wrote: On Sat, May 2, 2015 at 8:18 PM, Mark Engelberg mark.en...@gmail.com javascript: wrote: Clojure is great for creating new, disruptive web models, but what's the easiest path to creating something that can be done trivially with, say, Drupal or Django? The question tho' is why you'd want to use Clojure for something that is already trivially solved with free packaged software for widely used scripting languages where cheap, plentiful developers are falling over themselves to help... :) Clojure doesn't have to be the solution for every problem. It certainly doesn't need to be the solution for low-value problems... -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com javascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure needs a web framework with more momentum
To be honest it's disquieting that some of use think that because the problem is solved elsewhere we can't do better : we can, and we should. I appreciate the effort that has been made since the dawn of PHP for simple website - but we seem to be stuck on Rails iterative period - by that I mean that nothing that change (maybe not improve...) the status quo has arisen. Clojure, with its power and possibilities could be the mean to this end - I hope so (if not Clojure, let's hope it will be in a language that offer that much). In the meantime, the Luminus approach seem spot on : aggregate package and build on top of it. We have solution for nearly everything, but it can be sometime hard to discover it. Sometimes it's documentation, sometimes it's because there isn't a following huge enough to get result... Sad thing is : most of the libraries I've search for, even if obscure, are of very high quality. But let's not be sad : it's getting easier. Tools are getting better and better, and the web framework we're discussing about will probably arise soon. Other eco system are not that lucky - people want it to happen in the Clojure world. And they want it to be top notch ! On Tuesday, May 5, 2015 at 5:01:35 PM UTC+2, Gary Schiltz wrote: Colin's response is spot on. The Clojure ecosystem is a lot of fun, and is really good for solving complex problems, but I think it falls short for handling things that have already been solved in other less technically interesting ecosystems. Shopping carts and payment gateway integration, as he mentioned, are two obvious ones; anything related to customer relationship management is another category, i.e. mailing list management. Probably in these cases, it would be better to just go with the existing less elegant (technology-wise) solutions, including content management systems like WordPress, Joomla, or Drupal. In fact, it would be worthwhile to go through their plug-in pages to categorize what types of problems and solutions are provided for CMS type systems. Just be sure to wear tall boots if you have to wade into the PHP :-) On Sunday, May 3, 2015 at 1:21:31 AM UTC-5, Colin Fleming wrote: Because, in my case, I'm going to need a website shortly that I can use to sell Cursive. I'd really like to use Clojure for that. I could use Rails or Django which would make the site itself trivial, except I don't know either of them and then I'm stuck maintaining something in a language and framework I have no interest in and don't understand how to deploy or maintain. Or I could do it in Clojure which means that I understand the libraries, frameworks, deployment and monitoring inside and out, except I now have to implement a shopping cart and integrations with payments gateways etc. Neither of these are great options for me. On 3 May 2015 at 16:24, Sean Corfield se...@corfield.org wrote: On Sat, May 2, 2015 at 8:18 PM, Mark Engelberg mark.en...@gmail.com wrote: Clojure is great for creating new, disruptive web models, but what's the easiest path to creating something that can be done trivially with, say, Drupal or Django? The question tho' is why you'd want to use Clojure for something that is already trivially solved with free packaged software for widely used scripting languages where cheap, plentiful developers are falling over themselves to help... :) Clojure doesn't have to be the solution for every problem. It certainly doesn't need to be the solution for low-value problems... -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To
Dynamic/Convention-based routing libraries? (was: Clojure needs a web framework with more momentum
In the web framework thread, a number of routing libraries were mentioned but they all seemed to be based on explicit routing. I’m used to working in web environments where routing is usually implicit so that a request for: /foo/bar gets automatically routed to a method bar() in a handler named foo (usually as a class). This is nice because you don’t need to declare every route: you can just write a view template in the appropriate place and you have a web response — and you can add an appropriately named handler function and have the business logic automagically wired in. You can generally provide overrides for some explicit routes as well if you want them handled differently. Are there any such libraries for Clojure? Are they well-maintained? Sean Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Metadata loss. What am I doing wrong?
I expect because 'some-symbol is shorthand for (quote some-symbol), so you're attaching the metadata to a list that disappears once it's evaluated. - James On 5 May 2015 at 22:43, Andy- andre.r...@gmail.com wrote: Frankly, I would've (meta ^:abc 'some-symbol) expected to work. Maybe somebody else can weigh in on why this one is a no-go. On Tuesday, May 5, 2015 at 5:01:19 PM UTC-4, Andrey Antukh wrote: Thanks to both for the responses, but I stil not clearly understand. The documentation says very clearly that: In addition to with-meta, there are a number of reader macros (The Reader: Macro Characters) for applying metadata to the expression following it: ^{:doc How obj works!} obj - Sets the metadata of obj to the provided map. Equivalent to (with-meta obj {:doc How obj works!}) (def foo ^:abc [1 2 3]) - (meta foo) - {:abc true} (def foo ^:abc some-func) - (meta foo) - nil (def foo ^:abc 'some-symbol) - (meta foo) - nil (In clojure programming book uses example attaching metadata using the reader to the symbol, but seems it not works as expected) Is a little bit confusing. The metadata documentation says clearly that are equivalent, but are not equivalent. Thank you very much again. Regards. Andrey 2015-05-05 21:49 GMT+02:00 Andy- andre...@gmail.com: In addition to James comment: IMO clojure.org/metadata should be clearer about this. It's mentioned more clearly on the reader page: http://clojure.org/reader#The%20Reader--Macro%20characters The metadata reader macro first reads the metadata and attaches it to the next form read (see with-meta http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/with-meta to attach meta to an object): Stress on *next form read*. On Tuesday, May 5, 2015 at 2:31:40 PM UTC-4, Andrey Antukh wrote: Hi! I have some trouble with clojure metadata / reader and I do not know if I'm doing something wrong. I have this code: (defn some-func []) (def func ^:abc some-func) (assert (= (meta func) {:abc true})) (def data [[:bar (with-meta some-func {:abc true})] [:baz ^:abc some-func]]) (assert (= (meta (get-in data [0 1])) {:abc true})) (assert (= (meta (get-in data [1 1])) {:abc true})) It fails in the first assert and in the last (if I comment the first one obviously). I do not understand why that form of metadata does not works as I expect (http://clojure.org/metadata) Thank you very much. Regards. Andrey -- Andrey Antukh - Андрей Антух - andrei@kaleidos.net / ni...@niwi.be http://www.niwi.be http://www.niwi.be/page/about/ https://github.com/niwibe -- Andrey Antukh - Андрей Антух - andrei@kaleidos.net / ni...@niwi.be http://www.niwi.be http://www.niwi.be/page/about/ https://github.com/niwibe -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Metadata loss. What am I doing wrong?
Because ' is a reader macro which expands to the list (quote some-symbol), so the metadata is applied to the list, and not the symbol. You can verify this in the REPL - (meta (quote ^:abc 'some-symbol)) On Tuesday, May 5, 2015 at 5:43:19 PM UTC-4, Andy- wrote: Frankly, I would've (meta ^:abc 'some-symbol) expected to work. Maybe somebody else can weigh in on why this one is a no-go. On Tuesday, May 5, 2015 at 5:01:19 PM UTC-4, Andrey Antukh wrote: Thanks to both for the responses, but I stil not clearly understand. The documentation says very clearly that: In addition to with-meta, there are a number of reader macros (The Reader: Macro Characters) for applying metadata to the expression following it: ^{:doc How obj works!} obj - Sets the metadata of obj to the provided map. Equivalent to (with-meta obj {:doc How obj works!}) (def foo ^:abc [1 2 3]) - (meta foo) - {:abc true} (def foo ^:abc some-func) - (meta foo) - nil (def foo ^:abc 'some-symbol) - (meta foo) - nil (In clojure programming book uses example attaching metadata using the reader to the symbol, but seems it not works as expected) Is a little bit confusing. The metadata documentation says clearly that are equivalent, but are not equivalent. Thank you very much again. Regards. Andrey 2015-05-05 21:49 GMT+02:00 Andy- andre...@gmail.com: In addition to James comment: IMO clojure.org/metadata should be clearer about this. It's mentioned more clearly on the reader page: http://clojure.org/reader#The%20Reader--Macro%20characters The metadata reader macro first reads the metadata and attaches it to the next form read (see with-meta http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/with-meta to attach meta to an object): Stress on *next form read*. On Tuesday, May 5, 2015 at 2:31:40 PM UTC-4, Andrey Antukh wrote: Hi! I have some trouble with clojure metadata / reader and I do not know if I'm doing something wrong. I have this code: (defn some-func []) (def func ^:abc some-func) (assert (= (meta func) {:abc true})) (def data [[:bar (with-meta some-func {:abc true})] [:baz ^:abc some-func]]) (assert (= (meta (get-in data [0 1])) {:abc true})) (assert (= (meta (get-in data [1 1])) {:abc true})) It fails in the first assert and in the last (if I comment the first one obviously). I do not understand why that form of metadata does not works as I expect (http://clojure.org/metadata) Thank you very much. Regards. Andrey -- Andrey Antukh - Андрей Антух - andrei@kaleidos.net / ni...@niwi.be http://www.niwi.be http://www.niwi.be/page/about/ https://github.com/niwibe -- Andrey Antukh - Андрей Антух - andrei@kaleidos.net / ni...@niwi.be http://www.niwi.be http://www.niwi.be/page/about/ https://github.com/niwibe -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Testing strategies for cljc files
I'm wanting to migrate some files to cljc so a library can be used in Clojure and ClojureScript. I want to be able to run the same test suite against the Clojure and ClojureScript versions. What is the testing story for cljc files? If I made my test files cljc files as well, could I run clojure.test and clojurescript.test against the same test files? Or is there another more appropriate way of doing this? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ANN, GSoC] A Common Clojure Source Metadata Model
I'm mostly interested in something like http://docs.racket-lang.org/scribble/ On Mon, May 4, 2015 at 7:27 PM, richard.mo...@posteo.de wrote: Am Dienstag, 5. Mai 2015 01:56:13 UTC+9 schrieb Sean Grove: I've been hoping someone would rebuild Codeq https://github.com/Datomic/codeq, now that tools.analyzer (and friends) is out and ClojureScript has made so much progress. Not only would it be useful for diving into a new codebase (I've needed it several times when working with a large, unfamiliar codebase), but generating both useful and interesting docs from the structured data should be far easier than ad-hoc analysis. Just a thought, not sure that's the angle you want to take, but didn't see it on your list and each of the items on the list would probably have benefited from a revamped, well-documented, well-marketed Codeq. Oh, Codeq! I heard about it a long time ago on the Cognicast and it has been hopping across my mind now and then. I would also like it to come to life again. While it's not quite in the scope of my project, I think it could be one of the tools that can be (re)built on top of the metadata from my project. Maybe I'm remembering Codeq wrong, but I think it could just be recording the changes/snapshots of metadata according to my model over time by feeding them into Datomic. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure needs a web framework with more momentum
Justin Smith speaks the truth about Caribou. I'm also one of the team members, and although we did lose our funding, we're all still around and there are a number of active Caribou projects alive and well. It does have everything Justin says, and yes, it's imperfect, but it's also very easy to get a site up and running quickly. But you don't lose the modularity that we all love in the Clojure world. You can use just part of it (we know of numerous people using Polaris for routing, for example, and nothing else at all from the Caribou ecosystem) or all of it if you want. The CRUD UI in the admin tool is handy but a bit on the clunky side (for historical reasons which I won't go into here) but can be customised quite easily if you have a decent UI/UX person to do it. When we had our funding, we were all very invested in the project and are deeply proud of what we were able to achieve in a relatively short timespan. We also have the best URL :) http://let-caribou.in Cheers! Kyle On Tuesday, May 5, 2015 at 8:41:51 AM UTC-7, Justin Smith wrote: Wow, what a thread! As one of the authors and designers of Caribou, I have a couple of clarifications to offer. When the initial post compared contributors and commits, it picked our caribou repo, which, while extensive, holds no code, only our docs. The actual code is in caribou-core (persistence layer via edn abstraction), polaris (routing via edn data structures), caribou-api (rest api to caribou-core), antlers (an extended edn friendly mustache for templating), lichen (automated caching image resizer with optional s3 integration and stand alone http server), schmetterling (web ui for debugging exceptions, with in frame evaluation and locals display), caribou-frontend (pulling together core, antler, lichen, polaris and ring to make a site), and caribou-admin (crud ui for caribou-core models, including a drag and drop ui to define routes that can be imported by polaris). Caribou is not abandoned, though it did lose funding. I currently use core plus polaris without the other components at my day job, though working on Caribou itself is not strictly in scope for my salaried work. Which is to say, Caribou is very much a modular framework ( though much of it does rely on the caribou-core persistence abstraction). It's imperfect but useful, and work is slowed but not abandoned. I'm always always in #caribou on freenode, and we have extensive docs. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Metadata loss. What am I doing wrong?
In addition to James comment: IMO clojure.org/metadata should be clearer about this. It's mentioned more clearly on the reader page: http://clojure.org/reader#The%20Reader--Macro%20characters The metadata reader macro first reads the metadata and attaches it to the next form read (see with-meta http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/with-meta to attach meta to an object): Stress on *next form read*. On Tuesday, May 5, 2015 at 2:31:40 PM UTC-4, Andrey Antukh wrote: Hi! I have some trouble with clojure metadata / reader and I do not know if I'm doing something wrong. I have this code: (defn some-func []) (def func ^:abc some-func) (assert (= (meta func) {:abc true})) (def data [[:bar (with-meta some-func {:abc true})] [:baz ^:abc some-func]]) (assert (= (meta (get-in data [0 1])) {:abc true})) (assert (= (meta (get-in data [1 1])) {:abc true})) It fails in the first assert and in the last (if I comment the first one obviously). I do not understand why that form of metadata does not works as I expect (http://clojure.org/metadata) Thank you very much. Regards. Andrey -- Andrey Antukh - Андрей Антух - andrei@kaleidos.net javascript: / ni...@niwi.be javascript: http://www.niwi.be http://www.niwi.be/page/about/ https://github.com/niwibe -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: A more flexible versio of - ?
In addition to the Swiss Arrows library, I'd also suggest the shield blazoned with a green arrow on a white bend on green from the House Sarsfield of Sarsfield, a noble house from Sarsfield in the Westerlands: http://awoiaf.westeros.org/index.php/House_Sarsfield On Tuesday, May 5, 2015 at 9:37:42 AM UTC-4, Tj Gabbour wrote: I really like: https://github.com/jdevuyst/fletching-macros It's nice because you can use it with plain arrows... as little exceptions. On Tuesday, May 5, 2015 at 4:09:55 AM UTC+2, Frank Siler wrote: On May 4, 2015, at 1546, Kaiyin Zhong kindl...@gmail.com wrote: Wouldn't be nice to have something like: See also Swiss Arrows: https://github.com/rplevy/swiss-arrows Great article on “hard to Google” forms in Clojure: https://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/ Frank` -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: juxt/bidi ring question
I'm going to take a wild guess and say: missing wrap-content-type middleware perhaps? On Mon, 4 May 2015 at 20:37 Fluid Dynamics a2093...@trbvm.com wrote: On Monday, May 4, 2015 at 3:21:19 PM UTC-4, clifford wrote: Thanks @fluiddynamics your right on the money. On Monday, 4 May 2015 17:34:26 UTC+2, clifford wrote: Hi I am using juxt/bidi for route matching. with the following routes: (def routes [/ {index.html :index articles/ {index.html :article-index [:id] :article}}]) It correctly matches at the REPL. (match-route routes /articles/4) = {:handler :article, :route-params {:id 4}} However in the browser, when I hit the url, localhost:3000/articles/4 It attempts to download a file with name 4, can anybody let me know what I'm doing wrong here? Clifford YW. Now, just to satisfy the curious (and maybe help anyone else who runs into a similar problem): what was causing the Content-Type not to be correct? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure needs a web framework with more momentum
On Monday, May 4, 2015 at 4:41:02 AM UTC-4, Sven Richter wrote: One potential problem with this web framework as app template approach is upgrade-ability. When 2.0 of your framework comes out, what happens to an app generated from 1.0 that wants to benefit from the new capabilities? This is the reason I don't use Luminus or Modularity or others that rely heavily on leiningen template-based codegen. Its very difficult to upgrade the generated code, especially if you've had to add to or modify it. I'm experimenting with an approach that would generate only the project.clj file and directory structure (putting everything else into libraries), but don't yet have anything to release (my code is currently very targeted at my own use case, but in time I'd like to generalize it a bit and let others at it). -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure needs a web framework with more momentum
On 05.05.2015 03:02, Daniel Compton wrote: What this may look like for Clojure in 2015 is probably very different than what it looked like for Ruby in 2004. It may be a traditional framework, a lein template, a standard pattern of code, a set of conventions and loosely coupled protocols, pretty much exactly what we have now, or something entirely different. I think the ideal* would be a single starting point (website/brand/platform), with a mix of literate programming and library store. It could be a bit like a checklist of general concerns like routing, authentication and so on, listing and comparing mature libraries for each of those. If a literate program explains what is to be achieved and how you go about it in code, this would extend that concept to library selection. This would be the place to find out if seemingly competing libraries happen to have different strengths. Where library authors explain their choices and may find ways to join forces. Where it will be made clear, if a library does happen to be the best in its field or simply stands alone. Yes, of course I do see problems around reaching consensus ;) The development branch of this resource should be a gathering point for the community to define current best practices. * ideal for newcomers to learn how to go about web development, where covering standards like blogs and stores are not only matters for themselves, but serve as basis for free-form exploration. Ideal for seasoned developers for collaborating on furthering the whole field. -- Thorsten Wilms thorwil's design for free software: http://thorwil.wordpress.com/ -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Metadata loss. What am I doing wrong?
Hi! I have some trouble with clojure metadata / reader and I do not know if I'm doing something wrong. I have this code: (defn some-func []) (def func ^:abc some-func) (assert (= (meta func) {:abc true})) (def data [[:bar (with-meta some-func {:abc true})] [:baz ^:abc some-func]]) (assert (= (meta (get-in data [0 1])) {:abc true})) (assert (= (meta (get-in data [1 1])) {:abc true})) It fails in the first assert and in the last (if I comment the first one obviously). I do not understand why that form of metadata does not works as I expect (http://clojure.org/metadata) Thank you very much. Regards. Andrey -- Andrey Antukh - Андрей Антух - andrei.anto...@kaleidos.net / n...@niwi.be http://www.niwi.be http://www.niwi.be/page/about/ https://github.com/niwibe -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Metadata loss. What am I doing wrong?
When dealing with metadata, it's important to understand the difference between these two expressions: ^{:foo :bar} baz (with-meta baz {:foo :bar}) The first expression attaches metadata to the 'baz' symbol at compile time. The second expression attaches metadata to the data held in 'baz' at runtime. The ^ syntax is essentially used for passing information to the Clojure compiler, and to macros. It's not runtime information. - James On 5 May 2015 at 19:31, Andrey Antukh n...@niwi.be wrote: Hi! I have some trouble with clojure metadata / reader and I do not know if I'm doing something wrong. I have this code: (defn some-func []) (def func ^:abc some-func) (assert (= (meta func) {:abc true})) (def data [[:bar (with-meta some-func {:abc true})] [:baz ^:abc some-func]]) (assert (= (meta (get-in data [0 1])) {:abc true})) (assert (= (meta (get-in data [1 1])) {:abc true})) It fails in the first assert and in the last (if I comment the first one obviously). I do not understand why that form of metadata does not works as I expect (http://clojure.org/metadata) Thank you very much. Regards. Andrey -- Andrey Antukh - Андрей Антух - andrei.anto...@kaleidos.net / n...@niwi.be http://www.niwi.be http://www.niwi.be/page/about/ https://github.com/niwibe -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Metadata loss. What am I doing wrong?
Thanks to both for the responses, but I stil not clearly understand. The documentation says very clearly that: In addition to with-meta, there are a number of reader macros (The Reader: Macro Characters) for applying metadata to the expression following it: ^{:doc How obj works!} obj - Sets the metadata of obj to the provided map. Equivalent to (with-meta obj {:doc How obj works!}) (def foo ^:abc [1 2 3]) - (meta foo) - {:abc true} (def foo ^:abc some-func) - (meta foo) - nil (def foo ^:abc 'some-symbol) - (meta foo) - nil (In clojure programming book uses example attaching metadata using the reader to the symbol, but seems it not works as expected) Is a little bit confusing. The metadata documentation says clearly that are equivalent, but are not equivalent. Thank you very much again. Regards. Andrey 2015-05-05 21:49 GMT+02:00 Andy- andre.r...@gmail.com: In addition to James comment: IMO clojure.org/metadata should be clearer about this. It's mentioned more clearly on the reader page: http://clojure.org/reader#The%20Reader--Macro%20characters The metadata reader macro first reads the metadata and attaches it to the next form read (see with-meta http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/with-meta to attach meta to an object): Stress on *next form read*. On Tuesday, May 5, 2015 at 2:31:40 PM UTC-4, Andrey Antukh wrote: Hi! I have some trouble with clojure metadata / reader and I do not know if I'm doing something wrong. I have this code: (defn some-func []) (def func ^:abc some-func) (assert (= (meta func) {:abc true})) (def data [[:bar (with-meta some-func {:abc true})] [:baz ^:abc some-func]]) (assert (= (meta (get-in data [0 1])) {:abc true})) (assert (= (meta (get-in data [1 1])) {:abc true})) It fails in the first assert and in the last (if I comment the first one obviously). I do not understand why that form of metadata does not works as I expect (http://clojure.org/metadata) Thank you very much. Regards. Andrey -- Andrey Antukh - Андрей Антух - andrei@kaleidos.net / ni...@niwi.be http://www.niwi.be http://www.niwi.be/page/about/ https://github.com/niwibe -- Andrey Antukh - Андрей Антух - andrei.anto...@kaleidos.net / n...@niwi.be http://www.niwi.be http://www.niwi.be/page/about/ https://github.com/niwibe -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Metadata loss. What am I doing wrong?
The documentation is rather misleading, as it implies that obj can be a symbol. However, because ^ is a reader macro, it is applied to obj before it is evaluated. Clojure maps, vectors and sets all evaluate to themselves, so attaching metadata to the unevaluated expression via the ^ reader macro, is the same as attaching it to the evaluated expression via with-meta. So: ^:abc foo ^:abc [1 2 3] Will both attach the metadata directly to the literal value following it, but because 'foo' evaluates to something else, the reader metadata is lost after the symbol is evaluated. - James On 5 May 2015 at 22:01, Andrey Antukh n...@niwi.be wrote: Thanks to both for the responses, but I stil not clearly understand. The documentation says very clearly that: In addition to with-meta, there are a number of reader macros (The Reader: Macro Characters) for applying metadata to the expression following it: ^{:doc How obj works!} obj - Sets the metadata of obj to the provided map. Equivalent to (with-meta obj {:doc How obj works!}) (def foo ^:abc [1 2 3]) - (meta foo) - {:abc true} (def foo ^:abc some-func) - (meta foo) - nil (def foo ^:abc 'some-symbol) - (meta foo) - nil (In clojure programming book uses example attaching metadata using the reader to the symbol, but seems it not works as expected) Is a little bit confusing. The metadata documentation says clearly that are equivalent, but are not equivalent. Thank you very much again. Regards. Andrey 2015-05-05 21:49 GMT+02:00 Andy- andre.r...@gmail.com: In addition to James comment: IMO clojure.org/metadata should be clearer about this. It's mentioned more clearly on the reader page: http://clojure.org/reader#The%20Reader--Macro%20characters The metadata reader macro first reads the metadata and attaches it to the next form read (see with-meta http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/with-meta to attach meta to an object): Stress on *next form read*. On Tuesday, May 5, 2015 at 2:31:40 PM UTC-4, Andrey Antukh wrote: Hi! I have some trouble with clojure metadata / reader and I do not know if I'm doing something wrong. I have this code: (defn some-func []) (def func ^:abc some-func) (assert (= (meta func) {:abc true})) (def data [[:bar (with-meta some-func {:abc true})] [:baz ^:abc some-func]]) (assert (= (meta (get-in data [0 1])) {:abc true})) (assert (= (meta (get-in data [1 1])) {:abc true})) It fails in the first assert and in the last (if I comment the first one obviously). I do not understand why that form of metadata does not works as I expect (http://clojure.org/metadata) Thank you very much. Regards. Andrey -- Andrey Antukh - Андрей Антух - andrei@kaleidos.net / ni...@niwi.be http://www.niwi.be http://www.niwi.be/page/about/ https://github.com/niwibe -- Andrey Antukh - Андрей Антух - andrei.anto...@kaleidos.net / n...@niwi.be http://www.niwi.be http://www.niwi.be/page/about/ https://github.com/niwibe -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Metadata loss. What am I doing wrong?
Frankly, I would've (meta ^:abc 'some-symbol) expected to work. Maybe somebody else can weigh in on why this one is a no-go. On Tuesday, May 5, 2015 at 5:01:19 PM UTC-4, Andrey Antukh wrote: Thanks to both for the responses, but I stil not clearly understand. The documentation says very clearly that: In addition to with-meta, there are a number of reader macros (The Reader: Macro Characters) for applying metadata to the expression following it: ^{:doc How obj works!} obj - Sets the metadata of obj to the provided map. Equivalent to (with-meta obj {:doc How obj works!}) (def foo ^:abc [1 2 3]) - (meta foo) - {:abc true} (def foo ^:abc some-func) - (meta foo) - nil (def foo ^:abc 'some-symbol) - (meta foo) - nil (In clojure programming book uses example attaching metadata using the reader to the symbol, but seems it not works as expected) Is a little bit confusing. The metadata documentation says clearly that are equivalent, but are not equivalent. Thank you very much again. Regards. Andrey 2015-05-05 21:49 GMT+02:00 Andy- andre...@gmail.com javascript:: In addition to James comment: IMO clojure.org/metadata should be clearer about this. It's mentioned more clearly on the reader page: http://clojure.org/reader#The%20Reader--Macro%20characters The metadata reader macro first reads the metadata and attaches it to the next form read (see with-meta http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/with-meta to attach meta to an object): Stress on *next form read*. On Tuesday, May 5, 2015 at 2:31:40 PM UTC-4, Andrey Antukh wrote: Hi! I have some trouble with clojure metadata / reader and I do not know if I'm doing something wrong. I have this code: (defn some-func []) (def func ^:abc some-func) (assert (= (meta func) {:abc true})) (def data [[:bar (with-meta some-func {:abc true})] [:baz ^:abc some-func]]) (assert (= (meta (get-in data [0 1])) {:abc true})) (assert (= (meta (get-in data [1 1])) {:abc true})) It fails in the first assert and in the last (if I comment the first one obviously). I do not understand why that form of metadata does not works as I expect (http://clojure.org/metadata) Thank you very much. Regards. Andrey -- Andrey Antukh - Андрей Антух - andrei@kaleidos.net / ni...@niwi.be http://www.niwi.be http://www.niwi.be/page/about/ https://github.com/niwibe -- Andrey Antukh - Андрей Антух - andrei@kaleidos.net javascript: / ni...@niwi.be javascript: http://www.niwi.be http://www.niwi.be/page/about/ https://github.com/niwibe -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.