Skip to content

Conversation

@vologin-dmitry
Copy link
Owner

No description provided.

let mutable queue = new Queue<string>()

[<SetUp>]
let Setup () = queue <- new Queue<string>()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вообще, это обычные функции, в F# они пишутся со строчной

queue.Enqueue "1"
queue.Enqueue "2"
Assert.AreEqual("1", queue.Dequeue())
Assert.AreEqual("2", queue.Dequeue())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FsUbit же, зачем Assert.AreEqual

///Добавить в элемент
member this.Enqueue (value : 'a) =
let reversed = List.rev list
list <- List.rev (value :: reversed)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну, так можно, но можно было просто сконкатенировать в хвост. Работало бы вдвое быстрее :)

Copy link

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good enough, зачтена

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants