Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 5ed1805d1e2d61000670078f

C# data class to F# record

Converting from C# to F# is not hard, but requires some manual labor. Here you should convert from a C# data class to a F# record.

Start file
public enum State
{
  Active, Inactive
}

public struct Price
{
  public decimal Amount { get; set; }
  public decimal Vat { get; set; }
}

public class Ticket
{
  public State State { get; set; }
  public int Count { get; set; }
  public Price Price { get; set; }
  public DateTime DepartureDate { get; set; }
  public DateTime? ReturnDate { get; set; }
}
End file
type State = Active | Inactive

type Price = {
  amount: decimal
  vat: decimal
}

type Ticket = {
  state: State
  count: int
  price: Price
  departureDate: DateTime
  returnDate: DateTime option
}

View Diff

1,4c1
< public enum State
< {
<   Active, Inactive
< }
---
> type State = Active | Inactive
6,9c3,5
< public struct Price
< {
<   public decimal Amount { get; set; }
<   public decimal Vat { get; set; }
---
> type Price = {
>   amount: decimal
>   vat: decimal
12,18c8,13
< public class Ticket
< {
<   public State State { get; set; }
<   public int Count { get; set; }
<   public Price Price { get; set; }
<   public DateTime DepartureDate { get; set; }
<   public DateTime? ReturnDate { get; set; }
---
> type Ticket = {
>   state: State
>   count: int
>   price: Price
>   departureDate: DateTime
>   returnDate: DateTime option

Solutions

The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!

Check out these helpful resources to improve your Vim skills... Game on.

Unlock 17 remaining solutions by signing in and submitting your own entry
#18 Robin Abrahamsson / @rqAbrahamsson - Score: 119 - 05/29/20 @ 21:41
2cwtype<Esc>Jlr=Jwwr|i <Esc>jddj2cwtype<Esc>Ja= <Esc>jqq$da{vbdbPi:<Esc>b~bbdwA<BS><Esc>jq@qjj02cwtype<Esc>Ja= <Esc>j4@q$da{vbxbbPi:<Esc>brRrrbdwA<BS><BS> option<Esc>ZZ

0 comments


Created by: @rqAbrahamsson

18 active golfers, 79 entries

Leaderboard (lowest score wins):
63
#1 - せいほう / @FICSQF

05/30/2020 at 11:50PM

63
#2 - Guillaume Seren / @guillaumeseren

05/31/2020 at 03:53PM

63
#3 - Valdimar / @genkobar

06/02/2020 at 09:18PM

63
#4 - John Braxler / @braxler

08/30/2021 at 05:21PM

63
#5 - Luoyb / @Luoyb

10/26/2023 at 08:45AM

63
#6 - Aly Thobani / @alythobani

05/29/2024 at 10:43PM

63
#7 - Peppa Pig / @PeppaPigSg

06/29/2024 at 09:27AM

63
#8 - nickGPT / @nickandbro

08/24/2024 at 06:40AM

64
#9 - Saki Gw / @Sakigw

05/30/2020 at 08:38PM

67
#10 - garry quested / @GQuested

05/30/2020 at 09:19AM

69
#11 - hamb / @hamb88140219

02/21/2021 at 01:52PM

76
#12 - Smylers / @Smylers2

05/30/2020 at 06:58AM

77
#13 - quemeraisc / @quemeraisc

08/19/2022 at 12:11PM

83
#14 - Derek Schrock / @derekschrock

05/29/2020 at 10:26PM

89
#15 - RockerZZY / @rocker_zzy

06/07/2020 at 01:40PM

89
#16 - Volodymyr L / @Vladymyr_L

11/07/2021 at 04:29PM

93
#17 - Seve / @Seve_py

05/30/2020 at 03:15PM

119
#18 - Robin Abrahamsson / @rqAbrahamsson

05/29/2020 at 09:41PM