Skip to content

Co pocita fcelinspace? #10

Description

@s-m-i-t-a
def linspace(min, max, step)
    when is_number(min) and is_number(max) and is_integer(step) and min < max and 1 < step do
  delta = :erlang.abs(max - min) / (step - 1)

  Enum.reduce(1..(step - 1), [min], fn x, acc ->
    acc ++ [min + x * delta]
  end)
end

Proc je pouzit Enum.reduce/3 a pocetne narocne spojovani listu, kdyz lze pouzit Enum.map/2.

Co je vystupem teto fce, tedy co reprezentuje vraceny seznam?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions