Re: Attractive examples of function-generating functions

2012-08-08 Thread Jim Weirich

On Aug 8, 2012, at 1:50 PM, Timothy Baldridge tbaldri...@gmail.com wrote:

 
 I'm looking for medium-scale examples of using function-generating 
 functions.
 
 
 I'm not sure if this is exactly what you're looking for, but this sort of 
 thing is pretty cool: 
 
 (defn make-point [x y]
   (fn [member]
 (cond (= member :x) x
  (= member :y) y)))

Nice.  I always enjoyed this variation on the whole make-point theme:

(defn make-point [x y]
 (fn [f] (f x y)))

(defn point-x [pt]
 (pt (fn [x y] x)))

(defn point-y [pt]
 (pt (fn [x y] y)))

(def pt (make-point 1 2))

(println  [(point-x pt)
  (point-y pt)])

-- 
-- Jim Weirich
-- jim.weir...@gmail.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


Re: Clojure Koans?

2009-12-02 Thread Jim Weirich

On Dec 2, 2009, at 4:36 PM, ataggart wrote:

 If by koan you mean usage examples, then there are plenty of them
 within the clojure source itself, as well as clojure-contrib.

The Koans are more than just examples.  They are designed to  
demonstrate one concept at a time and are arranged so that each  
example builds on the previous ones.

 Leave it to rubyists to turn a simple concept like examples into some
 religious indoctrination.  I kid!

Actually, the Ruby Koans were very much inspired by the question/ 
answer style of the Little Lisper.  So now it has come full circle  
back to the Lisp world.

At one point in time I was considering putting together a set of  
Clojure koans, but got sidetracked with the SICP study. I discovered I  
can't learn Scheme and learn Clojure at the same time, so Clojure  
Koans are on hold for the moment.  If anyone wants to run with the  
idea, feel free.

-- 
-- Jim Weirich
-- jim.weir...@gmail.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


Re: Is knowing Java a prerequisite for using Clojure?

2009-09-17 Thread Jim Weirich

On Sep 17, 2009, at 3:44 PM, Daniel wrote:

 As for first books on Java,  Look for Bruce Eckel's Thinking in
 Java [...]

 [...] If you want an intro to Java that
 is not dry and treats you as a reasonably intelligent being, try
 'Thinking in Java'.

I would also recommend this book.  I choose this book for a Java  
course  I was teaching because it was one of the few books at that  
time that wasn't stuffed with Blatant Java Propaganda(tm), but took  
an honest look at the positives and negatives of the language.

-- 
-- Jim Weirich
-- jim.weir...@gmail.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
-~--~~~~--~~--~--~---



Re: Clojure Workshop in London next Monday

2009-07-21 Thread Jim Weirich


On Jul 14, 2009, at 8:56 PM, Alex Scordellis wrote:

 Next Monday evening we're hosting a Clojure Workshop at the
 ThoughtWorks offices in central London.


Rats!  I noticed this too late to make the event.  Too bad, it looked  
like fun.

-- 
-- Jim Weirich
-- jim.weir...@gmail.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
-~--~~~~--~~--~--~---



Re: Silly question from Programming Clojure

2009-06-05 Thread Jim Weirich


On Jun 5, 2009, at 11:40 AM, Laurent PETIT wrote:

 * OOSC: Object Oriented Software Construction ( general about object
 orientation, see http://archive.eiffel.com/doc/oosc/page.html )

Good book, although weak on the dynamic language side of things.

 * SICP: Structure and Interpretation of Computer Programs ( general,
 see http://mitpress.mit.edu/sicp/full-text/book/book.html )

Actually, I'm working through this now, but doing the examples and  
exercises in Clojure.

 * and now CTMCP: Concepts, Techniques and Models of computer
 programming ( covering all programming concepts/models, aka
 functional, imperative, object oriented, data flow, ... : see
 http://www.info.ucl.ac.be/~pvr/book.htm )

I've not seen this one and the link seems to be broken.  Try this: 
http://www.info.ucl.ac.be/~pvr/book.html

-- 
-- Jim Weirich
-- jim.weir...@gmail.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
-~--~~~~--~~--~--~---