Created
October 15, 2010 11:52
-
-
Save adilsoncarvalho/628072 to your computer and use it in GitHub Desktop.
My try to make Linq works on Boo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# IMPORTANT: | |
# Unfortunately this code does not work, and I am trying to figure out why | |
# | |
# | |
# Asking politely for Linq to show up | |
# | |
import System.Linq from "C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\v3.5\\System.Core.dll" | |
# | |
# This figures out if the number is even or odd | |
# | |
Even = { x | (x % 2) == 0 } | |
# | |
# Our little piece of data | |
# | |
values = (1, 2, 3, 4, 5, 6, 7, 8, 9) | |
# Must count 5 odds | |
assert 5 == values.Where({ x | not Even(x)}).Count() | |
# Must count 4 evens | |
assert 4 == values.Where({ x | Even(x)}).Count() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment