Nemerle Version of FizzBuzz
using Nemerle.Collections;
using Nemerle.Text;
using Nemerle.Utility;
using System;
using System.Collections.Generic;
using System.Console;
using System.Linq;
module Program
{
Main() : void
{
$[1 .. 100].Iter( x =>WriteLine("{0} {1}",x, x.FizzBuzz([(3,"Fizz"),(5,"Buzz")])));
_ = ReadLine();
}
static public IsMultipleOf(this x:int,mn : IEnumerable[int]) : IEnumerable[bool]{ mn.Map( n => x.IsMultipleOf(n))}
static public IsMultipleOf(this x:int,m:int):bool { (x % m) == 0 }
static public FizzBuzz(this x:int, ns : IEnumerable[ int * string]) : string
{ x.IsMultipleOf(ns.Map(e=>e[0])).Select(
(curr, i)=>
{|(true, _)=>ns.ElementAt(i)[1];
|(_ , _)=>""
}).Aggregate((p,c)=>p+c);
};
}
0 Comments On This Entry
Search My Blog
Recent Entries
Recent Comments
3 user(s) viewing
3 Guests
0 member(s)
0 anonymous member(s)
0 member(s)
0 anonymous member(s)
← February 2022 →
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 |
Tags
- .net
- .net4
- bf
- brainfuck
- Codeplex
- Coding
- custom Control
- custom controls
- DIC CodeAID VS Gallery
- Dice
- Die
- DLL
- Englishify
- Extension
- Extension Method
- ExtMethods
- F#
- Functional
- Functional Programming
- Graph
- Graphs
- Language Intergrated Query.
- Library
- LINQ
- LINQ Codes
- LISP interpreter
- Macro
- My Games
- Nemerle.
- net
- podcast
- Project
- Project Cider
- RadixSort Generics (Of T)
- restricted textbox
- Rolling
- rss
- rss feed
- Scribblings
- shadowtext
- Tips
- Transparent Textbox
- vb
- vb.net
- VB.net +LINQ Extension Method
- vb.net 1-Liners
- vb.net visual basic vs2010 .net4
- vs2010
- Weird
- XM
- xml
- XML Literals



Leave Comment









|