Re: [ANN] 'Elements of Clojure' is complete
Hey, glad to hear it. Excited to read the completed version over the holidays. On Sunday, December 2, 2018 at 4:25:42 PM UTC-7, Zach Tellman wrote: > > I'm very happy to announce, only two and a half years after the release of > the first chapter, that Elements of Clojure is completely finished. > Further details can be found here: > https://groups.google.com/forum/#!topic/elements-of-clojure/UUJjqU1rllU. > > If you've never heard of the book before, please check out its website: > http://elementsofclojure.com/ > > Zach > -- 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: How would I learn more about Clojure's class loading system?
Thanks for your help everyone. I think I'll make this a belated New Year's resolution. On Jan 6, 12:51 am, Brent Millare wrote: > Hi Daniel, > > I asked a question about the process of class reloading for different > clojure constructs. The following link may be helpful to you. > > http://stackoverflow.com/questions/7471316/how-does-clojure-class-rel... -- 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: How would I learn more about Clojure's class loading system?
Thanks Kevin, but I'm not so much looking for debugging help on this specific issue as I'm asking what I should do if I want to be able to, say, help others with similar issues in the future. Classpath stuff is a common bugaboo even for experienced Java developers (or so I hear), and all the finer points of clojure/Java interop have been a thorn in my side for a while now. I'd like to just blow a weekend or three immersing myself in the stuff and get a more fundamental understanding of it than I have now. Your mention of lein reminds me that I should probably spend some time digging through that as well, since I use it for all my projects. Anyway, sorry to be so unclear; part of the problem is that I'm not expert enough to know exactly what I'm looking for. But thanks for taking the time. -- 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
How would I learn more about Clojure's class loading system?
So school has started, and I'm laden with syllabi, either in print or online. I'm a stats student, so all my professors use LaTex for...well, everything. So I have all these .pdf files. I had the idea of parsing them and extracting the homework schedules and then making a simple Android app that showed what was due depending on the date. This is admittedly kind of overengineering the whole thing, but I just got the phone for Christmas and I've been itching to write something for it. In the process of trying to extract the text (I was using Apache's PDFBox), I ran into a NoClassDefFound error when importing certain classes. I checked that all the .jars were in all the right places, etc, to no avail. I wasn't so much frustrated by the error (they happen) as with my inability to do much about it or really poke at it. According to the Java docs, NCDF occurs when a class definition that was present at (Java's) compile time is absent at (Java's) runtime. I'm not really sure how that could happen---where could I go for more insight into how java packages/classes are loaded? (I actually have the clojure.core source in front of me as I write this, but can't seem to find where "defmacro import" becomes...well, whatever java it becomes) tl, dr: If I never wanted to have a classpath/library loading issue in Clojure ever again, what should I read? Thanks, Daniel -- 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: Rich Hickey: "Simple Made Easy" from Strange Loop 2011
Having watched Rich's talk yesterday, then Stu's "Simple Ain't Easy" talk an hour ago, I've been trying to wrap my head around this. What are the benefits of simplicity in the non-compound sense? Stu mentioned that often we think of simplicity in terms of counting things and then sort of brushed that aside, but it seems that chopping everything apart that can be chopped will inevitably lead to everything having one element (and therefore the closer to one, the more "simple," right?). When thinking at that basic level, it becomes apparent that a lot of things that we might think of as irreconcilably apple-orangey are in fact just different combinations of the same primitives--- '("sentences" "aren't" '(\w \o \r \d \s) "but" "they're" "both" "just chars at the bottom") This fact (and knowing it) lets you think of sentences and words as "really just combinations of collections and chars," so you'll be able to understand how word- or sentence-oriented functions work, while still retaining the power of dealing with sentences rather than a billion chars. And if you come up with your own abstraction (definitialism \G \N \U) , you can have very fine control over what does and does not go into it. So my questions are: Is this the basic concept Rich & Stu were getting at? If you're getting down to the bottom of the language, it helps if there's not much there and you build everything out of them. So isn't this recent focus on simplicity a sort of intellectual scion to Lisp's original raison d'etre, Joseph McCarthy's attempt to build a language out of the smallest number of primitives possible? And SICP/Little Schemer's focus on taking very very small/basic functions and building more ever more complex constructs out of them? As such, wouldn't it be useful to group the core functions by dependencies on each other, so that one could start with the simple and just read the source code for things composed with the basic? I realize I'm asking slightly odd questions, but I'm not sure exactly what I'm asking. I'm mostly trying to see if I have the feel right, but you can't really communicate feel by email, so I'm throwing out things that seem to resonate with the feel and seeing if they stick. -- 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: "Pipe" function
Ha, the argument order as written here was just off the top of my head; when I look at where I actually use it, it's [test f value] like Sean said, for use with partial. That said, I like to-fix's brevity over using partial all the time. Clojure makes it so easy to compose functions on the fly that I often forget it can be more convenient to do so beforehand. Thanks all. -- 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
"Pipe" function
One higher-order function I've found useful as I've goofed around with clojure has been one that I made up myself, but it's proved so useful and so simple that I have to believe it's in core somewhere: (defn pipe [test value f] (if (test value) (f value) value)) Is this a core function I'm just missing? -- 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: Emacs with Lisp and Clojure.
http://thtatithticth.blogspot.com/2011/02/obligatory-development-environment-post.html On Mar 24, 11:31 am, MarisO wrote: > swank-clojure is deprecated, don't use it. Instead start swank from > leiningen. > > I found these instructions how to install clojure support in > emacshttp://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html > > No need to use elpa with broken packages or starter-kit. > > Maris > > On Mar 24, 8:14 am, Tassilo Horn wrote: > > > mmwaikar writes: > > > But the same enter key works properly when I am using Lisp, so why > > > shouldn't it be the default in Clojure as well? > > > What's considered "properly" for RET is purely subjective. :-) > > > But I have to admit that I was wrong. When paredit-mode is enabled, RET > > is indeed bound to `paredit-newline', which does indentation > > automatically. For me that does the trick for Clojure, Elisp, and CL > > buffers... > > > > Also, after removing clojure-mode, when I try to install swank- > > > clojure, it again installs the clojure-mode, but fails to install > > > itself? > > > Do you get some error messages? > > > Using emacs 24 from bzr, I only added > > > (add-to-list 'package-archives > > '("technomancy" . "http://repo.technomancy.us/emacs/";) t) > > > to get the most recent packages from technomancy listed in M-x > > package-list-packages, and there I installed these ones: > > > clojure-mode 1.8.0 installed Major mode for Clojure code > > slime 20100404.1 installed Superior Lisp Interaction Mode > > for Emacs > > slime-repl 20100404 installed Read-Eval-Print Loop written in > > Emacs Lisp > > swank-clojure 1.1.0 installed Slime adapter for clojure > > > Bye, > > Tassilo -- 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 newbie's summary - what worked, what didn't
I'm sure you're sick of how-to's by now (I was), but I took the trouble to write down EXACTLY what I did for an Ubuntu/emacs/swank/ SLIME/leiningen set-up. On Mar 26, 5:40 pm, Mark Engelberg wrote: > On Sat, Mar 26, 2011 at 4:29 PM, ultranewb wrote: > > On Mar 27, 12:35 am, Mark Engelberg wrote: > >> Type some Clojure code into the file you created. Save periodically > >> with "Ctrl-x Ctrl-s". When you want to try out your code, type > >> "Ctrl-c ctrl-k" and all your code will be evaluated and those > >> definitions will now be available for interactive use in your REPL. > > > Everything works up until C-c Ck, where I get a "C-c C-k is undefined" > > error :-( > > Make sure the pane with your code is the active pane when you type > Ctrl-c Ctrl-k. It won't work if the focus is on the REPL. -- 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: Transforming map entries
I don't know if it's specified in the documentation anywhere, but (= map-I-made-up (zipmap (keys map-I-made-up) (vals map-I-made-up))) returns true. On Feb 22, 5:17 pm, Mike Meyer wrote: > On Tue, 22 Feb 2011 15:36:02 -0800 (PST) > > Daniel Bell wrote: > > I can't think of anything core, but > > > (let [f #(. % toUpperCase)] > > (zipmap (keys skills) (map f (vals skills doesn't seem too bad. > > Does clojure guarantee that keys & vals return things in the proper > order for this to work? Since it doesn't guarantee that serializing > the entries of a map will always get the same order, that seems > unlikely. > > thanks, > -- > Mike Meyer http://www.mired.org/consulting.html > Independent Software developer/SCM consultant, email for more information. > > O< ascii ribbon campaign - stop html mail -www.asciiribbon.org -- 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: Ordering of defn's?
This is true. But you "declare" lets you throw out all the names you need to at the beginning to avoid circular definitions and the like. eg. (declare sum) (defn average [coll] (/ (sum coll) (count coll))) (defn sum [coll] (apply + coll)) On Feb 21, 11:05 pm, Jonathan Mitchem wrote: > I'm new to Lisps in general, and very new to Clojure. > > When I was trying out CL, I could put my "defun/defn"s in any order in > the file, and it would load and run fine in the REPL. However, in > Clojure, it seems to be much more C/C++-like and I have to define > things before I use them in other defns. > > Is this... correct? Or is it just a limitation of the IDEs I've been > trying out? > > E.g., it seems like I have to define "sum" before I can define > "average". -- 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: Transforming map entries
I can't think of anything core, but (let [f #(. % toUpperCase)] (zipmap (keys skills) (map f (vals skills doesn't seem too bad. On Feb 21, 8:08 pm, yair wrote: > I'm hoping this is a dumb question and I've missed something obvious. > I have a map with various key-value pairs and I want to transform some > of the values, e.g. > > (def mymap {:first "john" :last "smith" :age 25}) and say I want to > change the strings to be upper case. > Right now all I can think of doing is using reduce and passing in an > empty map and the re-associating each key with the (possibly) > transformed value. Is there something like the map function that > takes two parameters, one a function that receives a pair and returns > a new pair, and the other a map, and returns a map that's > reconstituted from those pairs? > > 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
Re: (:multiplexing clojure.contrib.sql = nil?)
I may be using the term wrong; while concurrency isn't necessary, I'm really just looking to minimize the # of times I'm opening/closing connections, but also looking to minimize unnecessary open connections. I suspect what I'm really looking for is a macro to detect every instance of "(sql/with-connection" in a form, delete them all, and then wrap them in one with-connection form. Which probably means I should get to writing it myself. But if anyone knows of one already in existence, I'm all ears. Cheers, Daniel On Nov 13, 11:30 pm, Shantanu Kumar wrote: > Not sure what you meant by multiplexing? Did you mean "concurrent > execution" of SQL statements on the same connection? > > Regards, > Shantanu > > On Nov 14, 4:00 am, Daniel Bell wrote: > > > I'm just getting my feet wet w/clojure's sql library, and I got to > > wondering---is multiplexing implemented in a library somewhere? Or is > > it already part of contrib.sql but executed behind the scenes? > > > Thanks, > > > ---Dan -- 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
(:multiplexing clojure.contrib.sql = nil?)
I'm just getting my feet wet w/clojure's sql library, and I got to wondering---is multiplexing implemented in a library somewhere? Or is it already part of contrib.sql but executed behind the scenes? Thanks, ---Dan -- 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: "Parameterized" SQL queries?
This is awesome, guys. Clear and helpful. Thanks a ton. And Sean, I actually already know how with-query-results worked...from studying the example on your blog. Thanks again! ---Daniel On Nov 10, 11:07 am, Saul Hazledine wrote: > On Nov 10, 6:35 pm, Daniel Bell wrote: > > > I'm a newb to both SQL and Clojure, and after reading this post > > (http://groups.google.com/group/clojure/browse_thread/thread/718fa1b72... > > ) I was curious as to exactly it means to parameterize a query. Is it > > a way to automatically insert arguments into the query, a way to > > destructure the results, or what? > > A normal query: > select name from employee where department = 'xfiles' > > A parameterised query (prepared statement) which can be called later > with the parameter "xfiles": > select name from employee where department = ? > > Most databases support prepared statements which can be parsed once > and then called multiple times for improved performance. The setup > though has some overhead and you will occasionally hear people saying > that parameterised queries are overrated. However, with JDBC, prepared > statements have the advantage that the parameters, ?, are protected > from SQL injection attacks: > > http://www.owasp.org/index.php/Preventing_SQL_Injection_in_Java > > I'd recommend that you use prepared statements where possible - all > the clojure database libraries support them and clojure.contrib.sql > creates them behind the scenes when you do things such as insert > records. > > Saul -- 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
"Parameterized" SQL queries?
I'm a newb to both SQL and Clojure, and after reading this post ( http://groups.google.com/group/clojure/browse_thread/thread/718fa1b725389639/4c4d7ed1492e082b?lnk=gst&q=sql+parameterized#4c4d7ed1492e082b ) I was curious as to exactly it means to parameterize a query. Is it a way to automatically insert arguments into the query, a way to destructure the results, or what? Thanks, ---Dan -- 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: Spit is core now. How to append?
I figured it out; if anyone has trouble with this in the future and Googles this, it's done by (spit f content :append true) On Nov 3, 1:57 pm, Daniel Bell wrote: > Clojuredocs mentioned that opts could be passed to clojure.java.io/ > Writer, but (little Java background), I'm having a hard time figuring > out what the analog to "options" is in the Java API. Any help? > > 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
Spit is core now. How to append?
Clojuredocs mentioned that opts could be passed to clojure.java.io/ Writer, but (little Java background), I'm having a hard time figuring out what the analog to "options" is in the Java API. Any help? 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