Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx01.iad01.newshosting.com!newshosting.com!69.16.185.11.MISMATCH!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Java 8 Lambda binary snapshot Date: Mon, 14 Nov 2011 06:51:56 -0800 (PST) Organization: http://groups.google.com Lines: 48 Message-ID: <11933108.94.1321282316164.JavaMail.geo-discussion-forums@prmf13> References: <2244638.2045.1321057203472.JavaMail.geo-discussion-forums@prep8> <0kuvb71v0ie3qtupn8d04q27fer5s0l49u@4ax.com> <4ec000d8$0$293$14726298@news.sunsite.dk> Reply-To: comp.lang.java.programmer@googlegroups.com NNTP-Posting-Host: 173.164.137.214 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1321282438 19455 127.0.0.1 (14 Nov 2011 14:53:58 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 14 Nov 2011 14:53:58 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.164.137.214; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Google-Web-Client: true Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9956 Nasser M. Abbasi wrote: > ps. I just heard about this Lambda thing ;) "This Lambda [sic] thing" has been around longer than the Java language. > This looks like the ability to have, what is called in Mathematica, > or may be other functional languages, a pure function, that one > can define and use on the fly ? > > For example, in Mathematica, one can write > > "Sort[list,p] > sorts using the ordering function p. " > > and is coded like this, for example: > > In[11]:= Sort[{4,1,3,2,2},#1>#2&] > Out[11]= {4,3,2,2,1} > > where the '&' indicates the end of the function, and > #1 means first argument, and #2 mean the second argument. This has existed in Java since about version 1.1, only the syntax is rather more verbose. They don't call it "pure function" in Java; there is no such thing. It's called "implementation of a callback interface" in Java. The "lambda" feature of Java 8 is a syntactic sweetener of the interface-implementation idiom, not the addition of "pure" (whatever that means) functions. > One can also write the pure function more explicit, like this: > > In[8]:= Sort[{4,1,3,2,2},Function[{x,y},x Out[8]= {1,2,2,3,4} > > Is this, somewhat, close to what Lambda in Java allows? Why not read the literature, cited at the top of this thread? That question was answered from the very start of this conversation. Of course, it does require that you actually click to and read the information. OTOH, documentation is a wonderful thing, and the habit of studying it a most empowering one. Try it, why don't you? > It is very useful feature to be able to do this sort of thing. > (I need to read more about Java 8, sounds interesting) Yes - yes you do. -- Lew