Sha256: 814f9d1aaadb2fdf1ed6a229d592714650bb79280e37fa1fd2016cd0fabfd2fa

Contents?: true

Size: 658 Bytes

Versions: 213

Compression:

Stored size: 658 Bytes

Contents

"
" TravisCI's Trusty uses Vim 7.4.52. No uniq() for us.
"

function! Equilateral(triangle) abort
  let [a, b, c] = a:triangle
  return s:invalid(a:triangle) ? 0 : a == b && a == c
endfunction

function! Isosceles(triangle) abort
  let [a, b, c] = a:triangle
  return s:invalid(a:triangle) ? 0 : a == b || a == c || b == c
endfunction

function! Scalene(triangle) abort
  let [a, b, c] = a:triangle
  return s:invalid(a:triangle) ? 0 : a != b && a != c && b != c
endfunction

function! s:invalid(triangle) abort
  let [a, b, c] = a:triangle

  if a == 0 || b == 0 || c == 0 || a + b < c || a + c < b || b + c < a
    return 1
  endif

  return 0
endfunction

Version data entries

213 entries across 213 versions & 1 rubygems

Version Path
trackler-2.1.0.41 tracks/vimscript/exercises/triangle/example.vim
trackler-2.1.0.40 tracks/vimscript/exercises/triangle/example.vim
trackler-2.1.0.39 tracks/vimscript/exercises/triangle/example.vim
trackler-2.1.0.38 tracks/vimscript/exercises/triangle/example.vim
trackler-2.1.0.37 tracks/vimscript/exercises/triangle/example.vim
trackler-2.1.0.36 tracks/vimscript/exercises/triangle/example.vim
trackler-2.1.0.34 tracks/vimscript/exercises/triangle/example.vim
trackler-2.1.0.33 tracks/vimscript/exercises/triangle/example.vim
trackler-2.1.0.32 tracks/vimscript/exercises/triangle/example.vim
trackler-2.1.0.31 tracks/vimscript/exercises/triangle/example.vim
trackler-2.1.0.30 tracks/vimscript/exercises/triangle/example.vim
trackler-2.1.0.29 tracks/vimscript/exercises/triangle/example.vim
trackler-2.1.0.28 tracks/vimscript/exercises/triangle/example.vim