-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
They worked without modifications, but I wrote them so we're keeping them. Issue #236
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// error-pattern:fail | ||
|
||
fn main() { | ||
let cheese = "roquefort"; | ||
let carrots = @"crunchy"; | ||
|
||
fn (tasties: @str, macerate: &block(&str)) { | ||
macerate(*tasties); | ||
} (carrots, { |&food| | ||
let mush = food + cheese; | ||
lambda() { | ||
let chew = mush + cheese; | ||
fail "so yummy" | ||
} (); | ||
}); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// error-pattern:fail | ||
|
||
use std; | ||
import std::map; | ||
import std::uint; | ||
|
||
fn main() { | ||
let count = @mutable 0u; | ||
let hash = bind fn (_s: &[@str], count: @mutable uint) -> uint { | ||
*count += 1u; | ||
if *count == 10u { | ||
fail; | ||
} else { | ||
ret *count; | ||
} | ||
} (_, count); | ||
|
||
fn eq(s: &[@str], t: &[@str]) -> bool { | ||
ret s == t; | ||
} | ||
|
||
let map = map::mk_hashmap(hash, eq); | ||
let arr = []; | ||
for each i in uint::range(0u, 10u) { | ||
arr += [@"key stuff"]; | ||
map.insert(arr, arr + [@"value stuff"]); | ||
} | ||
} |