2 people like it.

Palindrome

Palindrome test.

1: 
2: 
3: 
4: 
5: 
let inline palindrome l = List.rev l = l

[1; 2; 3; 4; 5] |> palindrome = false
["r"; "a"; "c"; "e"; "c"; "a"; "r"] |> palindrome  = true
[1; 1; 3; 3; 1; 1] |> palindrome = true
val palindrome : l:'a list -> bool (requires equality)

Full name: Script.palindrome
val l : 'a list (requires equality)
Multiple items
module List

from Microsoft.FSharp.Collections

--------------------
type List<'T> =
  | ( [] )
  | ( :: ) of Head: 'T * Tail: 'T list
  interface IEnumerable
  interface IEnumerable<'T>
  member Head : 'T
  member IsEmpty : bool
  member Item : index:int -> 'T with get
  member Length : int
  member Tail : 'T list
  static member Cons : head:'T * tail:'T list -> 'T list
  static member Empty : 'T list

Full name: Microsoft.FSharp.Collections.List<_>
val rev : list:'T list -> 'T list

Full name: Microsoft.FSharp.Collections.List.rev

More information

Link:http://fssnip.net/qQ
Posted:9 years ago
Author:Pitch Rock
Tags: palindrome