Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #30506

Re: The Grand Canyon

From Jeff Higgins <jeff@invalid.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: The Grand Canyon
Date 2014-12-08 01:21 -0500
Organization A noiseless patient Spider
Message-ID <m63g2d$9j9$1@dont-email.me> (permalink)
References <Canyon-20141208004520@ram.dialup.fu-berlin.de>

Show all headers | View raw


On 12/07/2014 06:59 PM, Stefan Ram wrote:
>    Today, I saw the Grand Canyon!
>
>    Say, you want to count the even numbers of a list.
>    Well, that's easy, you just ...
>
>
> public class Main
> { public static void main( final java.lang.String args[] )
>    { final java.util.List< java.lang.Integer >list = java.util.Arrays.asList( 1, 2, 3, 4 );
>      java.lang.System.out.println( list.stream().filter( i -> 0 == i % 2 ).count() ); }}
>
>    Now, say, you want to count the vowel letters in a string.
>
> public class Main
> { public static void main( final java.lang.String args[] )
>    { final java.lang.String s = "alpha";
>      ... x = ... s ... ;
>      java.lang.System.out.println( x.stream().filter( ch -> "aeiou".contains( ch )).count() ); }}
>
>    Can you fill in something for »...« to bridge the gap between
>    the string and the filter counter? (The output should be »2«.)
>
>    You can't.
>
>    So, this is not just a gap, it's a canyon.
>
>    The Grand Canyon of Java programming!
>
So, after much study, I conclude you will:
For each language, and dialect of that language;
Construct a word->IPA transcription dictionary:
Split the string into words:
Map the words to their IPA transcription:
Filter the vowels from the transcriptions:
Reduce to a vowel count.
Voilà! vwäˈlä

Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: The Grand Canyon Jeff Higgins <jeff@invalid.invalid> - 2014-12-08 01:21 -0500
  Re: The Grand Canyon Jeff Higgins <jeff@invalid.invalid> - 2014-12-08 01:48 -0500

csiph-web