Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #31720
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2015-05-18 06:29 -0700 |
| References | <Nfy4x.122164$566.49072@fx20.iad> <b4eb4b14-d6bd-41f9-bd6b-5a6af5c7c0a9@googlegroups.com> |
| Message-ID | <3d5ec0f1-c5ba-4b35-9bba-0e679f811bdf@googlegroups.com> (permalink) |
| Subject | Re: Puzzler: Fun with Streams. |
| From | scattered <rescattered@gmail.com> |
On Monday, May 18, 2015 at 8:49:19 AM UTC-4, scattered wrote: > On Tuesday, May 12, 2015 at 10:01:28 PM UTC-4, Daniel Pitts wrote: > > It occurred to me that I could write this little snippet someplace, and > > it would work. > > > > return stream.filter(o->o<-o); > > > > stream is an object which implements java.util.stream.BaseStream, though > > I won't tell you which one > > > > Might be obvious to everyone, but I thought it was a good little puzzler. > > > > What input do you think this will work with, and what is the result? > > Interesting. At first I thought that you had a letter o and the number 0 (which would also work for something like o->0<-o) but then I noticed that they were all letters, which of course also works. > > variations: find contexts for the lambda expressions: > 1) o->oo<-o > > 2) o->0_0<-o > > 3) x->0x0<-x > > (2 and 3 are essentially identical) > > A full-fledged functional language like ML would allow for things like > > x->xx->xx<-x (lambda expressions returning lambda expressions, with right-associativity of ->) > > but I can't seem to make that work in Java8 still another: o->--o-o--<-o describe what survives when an int stream is filtered by the above o->o--+--o<-o is also fun doubtless you can get even weirder expressions when you bring shift operators into play. Puzzle: call these things executable palindromes. What is the most obscure executable palindrome? (ill defined puzzle since there is no natural limit to obscurity, as anybody who has seen entries to the obfuscated C contest knows)
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Puzzler: Fun with Streams. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2015-05-12 19:01 -0700
Re: Puzzler: Fun with Streams. Jeff Higgins <jeff@invalid.invalid> - 2015-05-13 08:21 -0400
Re: Puzzler: Fun with Streams. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2015-05-13 12:49 -0700
Re: Puzzler: Fun with Streams. scattered <rescattered@gmail.com> - 2015-05-18 05:49 -0700
Re: Puzzler: Fun with Streams. scattered <rescattered@gmail.com> - 2015-05-18 06:29 -0700
Re: Puzzler: Fun with Streams. javadiscover@gmail.com - 2015-06-10 03:19 -0700
csiph-web