• + 0 comments

    Haskell:

    rev l = [ l !! (i-1) | i <- [length l, length l - 1 .. 1]]
    

    [length l, length l - 1 .. 1] -- generates a list of decreasing indexes

    l !! (i-1) -- accesses the (i-1)th element of l

    all within a list comprehension.