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 5ed25358070f0e0006193c04

C# function to F#

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

Start file
private static string GetData(Environment environment, string name)
{
  var options = new DefaultOptions();
  if (environment.IsDevelopment())
  {
    options.LocalCredentials = true;
    options.Path = "/stuff";
  }
  else
  {
    options.LocalCredentials = false;
  }
  var uri = new Uri("https://example.com/" + name);
  var client = new GetClient(uri, options);
  return client.GetStuff(name);
}
End file
let getData (environment: Environment) (name: string) : string =
  let options = DefaultOptions()
  if environment.IsDevelopment() then
    options.LocalCredentials <- true
    options.Path <- "/stuff"
  else
    options.LocalCredentials <- false
  let uri = Uri("https://example.com/" + name)
  let client = GetClient(uri, options)
  client.GetStuff(name)

View Diff

1,8c1,5
< private static string GetData(Environment environment, string name)
< {
<   var options = new DefaultOptions();
<   if (environment.IsDevelopment())
<   {
<     options.LocalCredentials = true;
<     options.Path = "/stuff";
<   }
---
> let getData (environment: Environment) (name: string) : string =
>   let options = DefaultOptions()
>   if environment.IsDevelopment() then
>     options.LocalCredentials <- true
>     options.Path <- "/stuff"
10,16c7,10
<   {
<     options.LocalCredentials = false;
<   }
<   var uri = new Uri("https://example.com/" + name);
<   var client = new GetClient(uri, options);
<   return client.GetStuff(name);
< }
\ No newline at end of file
---
>     options.LocalCredentials <- false
>   let uri = Uri("https://example.com/" + name)
>   let client = GetClient(uri, options)
>   client.GetStuff(name)
\ No newline at end of file

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 10 remaining solutions by signing in and submitting your own entry
#11 dotvimrc / @dotvimrc1 - Score: 160 - 05/31/20 @ 18:52
3dwrg<Esc>ilet <Esc>f(i <Esc>fEref i:<Esc>ferE<Esc>f,r)<Esc>fsdwi(<Esc>ea: string<Esc>A : string =<Esc>j**:g//d<CR>j*:g//d<CR>dw:s<BS>%s/var/let/g<CR>:%s/;//g<CR>:%s/new //g<CR>:3<CR>f(xf);xA then<Esc>/=<CR>xi<-<Esc>n.lxnxi<-<Esc>ZZ

0 comments


Created by: @rqAbrahamsson

11 active golfers, 30 entries

Leaderboard (lowest score wins):
101
#1 - Luoyb / @Luoyb

10/26/2023 at 05:34AM

101
#2 - Peppa Pig / @PeppaPi95550250

07/02/2024 at 06:36AM

105
#3 - quemeraisc / @quemeraisc

08/19/2022 at 11:54AM

108
#4 - hamb / @hamb88140219

02/21/2021 at 11:22AM

110
#5 - 0xf00ff00f / @0xf00ff00f

12/17/2022 at 11:58PM

112
#6 - せいほう / @FICSQF

05/30/2020 at 05:24PM

118
#7 - Sammit / @somemeatjain

02/03/2022 at 05:39PM

118
#8 - nickGPT / @nickandbro

08/24/2024 at 06:27AM

122
#9 - POSIX / @po6ix

01/07/2022 at 02:13AM

128
#10 - Robin Abrahamsson / @rqAbrahamsson

05/31/2020 at 08:09AM

160
#11 - dotvimrc / @dotvimrc1

05/31/2020 at 06:52PM