Skip to content

Instantly share code, notes, and snippets.

@adilsoncarvalho
Created October 15, 2010 11:52
Show Gist options
  • Save adilsoncarvalho/628072 to your computer and use it in GitHub Desktop.
Save adilsoncarvalho/628072 to your computer and use it in GitHub Desktop.
My try to make Linq works on Boo
#
# 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