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.2.1.180 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.179 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.178 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.177 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.176 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.175 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.174 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.173 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.172 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.171 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.170 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.169 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.167 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.166 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.165 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.164 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.163 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.162 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.161 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.160 tracks/vimscript/exercises/triangle/example.vim