List functions are in the module List. So, you should use List.filter. Available list functions can be found in the manual: [link:research.microsoft.com]
If you still have problems, here are some solutions:

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
29
>let even x = x % 2 = 0;;
val even : int -> bool

> let negate f = fun x -> not (f x);;
val negate : ('a -> bool) -> 'a -> bool

> List.filter (negate even) [1; 2; 3; 4; 5];;
val it : int list = [1; 3; 5]

> [1; 2; 3; 4; 5].Filter(negate even);;
val it : int list = [1; 3; 5]

> [1..5].Filter(negate even);;
val it : int list = [1; 3; 5]

> List.fold1_left (-) [1..5];;
val it : int = -13

> List.fold_left (-) 1 [2..5];;
val it : int = -13

> List.map2 (+) ["Rip"; "Rap"; "Rup"] [", "; ", and "; ""] |> String.concat "";;
val it : string = "Rip, Rap, and Rup"

> List.map2 (+) ["Rip"; "Rap"; "Rup"] [", "; ", and "; ""] |> List.fold1_left (+);;
val it : string = "Rip, Rap, and Rup"

> List.map2 (+) ["Rip"; "Rap"; "Rup"] [", "; ", and "; ""] |> List.fold_left (+) "";;
val it : string = "Rip, Rap, and Rup"

Laurent.

By on 8/31/2007 3:50 AM ()

Hi,
You can find some useful examples to start with in the "F# Samples" project at CodePlex:
[link:www.codeplex.com]

You can write similar things as in LISP/Scheme, though there is one big difference - F# is statically typed language, meaning that all values have different types. F# uses type-inferrence, so you don't usually have to write types explicitly.

In general F# has similar core-language as ML or OCaml, so you can look at some ML/OCaml tutorials to learn F#. I would also recommend Robert Pickering's book as a good introduction to F#:

[link:www.amazon.com]&

By on 8/30/2007 7:33 PM ()

I'm rather sure they are just functions in the F# List libraries.

By on 8/30/2007 7:12 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper