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.159 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.158 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.157 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.156 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.155 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.154 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.153 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.152 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.151 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.150 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.149 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.148 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.147 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.146 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.145 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.144 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.143 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.142 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.141 tracks/vimscript/exercises/triangle/example.vim
trackler-2.2.1.140 tracks/vimscript/exercises/triangle/example.vim