Skip to main content
added 374 characters in body
Source Link

Ruby, 86 8383 71 bytes

f=->s,v=[]{s.size>0?s[0]&&(s.reject!( &:empty?);f[s;[s.map{_1[1..]_1[0]},v<<sf[s.map{_1[0]}_1[1..]):v}]].join)}

Attempt This Online!Attempt This Online!

A rather naive approach and my first ruby golfgolf; later I could improve using some tips from my other Ruby golf.

  • s.reject!( &:empty?) removes all empty strings from the array;

  • s.map{_1[1..]} the first letters are removed;

  • v<<ss.map{_1[0]} and added to the output vector;

  • while s.length>0  ss[0]&&(.length>0..) the process is repeated recursively until all strings were removed and the output vector is joined to a string.

Ruby, 86 83 bytes

f=->s,v=[]{s.size>0?(s.reject!(&:empty?);f[s.map{_1[1..]},v<<s.map{_1[0]}]):v.join}

Attempt This Online!

A rather naive approach and my first ruby golf.

  • s.reject!(&:empty?) removes all empty strings from the array;

  • s.map{_1[1..]} the first letters are removed;

  • v<<s.map{_1[0]} and added to the output vector;

  • whiles.length>0 the process is repeated recursively until all strings were removed and the output vector is joined to a string.

Ruby, 86 83 71 bytes

f=->s{s[0]&&(s.reject! &:empty?;[s.map{_1[0]},f[s.map{_1[1..]}]].join)}

Attempt This Online!

A rather naive approach and my first ruby golf; later I could improve using some tips from my other Ruby golf.

  • s.reject! &:empty? removes all empty strings from the array;

  • s.map{_1[1..]} the first letters are removed;

  • s.map{_1[0]} and added to the output vector;

  • while s.length>0  s[0]&&(...) the process is repeated recursively until all strings were removed and the output vector is joined to a string.

added 274 characters in body
Source Link

Ruby, 8686 83 bytes

f=->s,v=[]{v=[];while s.size>0;ssize>0?(s.reject!(&:empty?);v<<s.map{_1[0]};s;f[s.map!{_1[1..]}end;v,v<<s.map{_1[0]}]):v.join}

Attempt This Online!Attempt This Online!

A rather naive approach and my first ruby golf.

  • s.reject!(&:empty?) removes all empty strings from the array;

    s.reject!(&:empty?) removes all empty strings from the array;

  • v<<s.map{_1[0]} the first letters are added to the output vector

    s.map{_1[1..]} the first letters are removed;

  • s.map!{_1[1..]} and the first letters are removed

    v<<s.map{_1[0]} and added to the output vector;

  • while s.length>0 the process is repeated until all strings were removed and the output vector is joined to a string

    whiles.length>0 the process is repeated recursively until all strings were removed and the output vector is joined to a string.

Ruby, 86 bytes

->s{v=[];while s.size>0;s.reject!(&:empty?);v<<s.map{_1[0]};s.map!{_1[1..]}end;v.join}

Attempt This Online!

A rather naive approach and my first ruby golf.

  • s.reject!(&:empty?) removes all empty strings from the array;
  • v<<s.map{_1[0]} the first letters are added to the output vector
  • s.map!{_1[1..]} and the first letters are removed
  • while s.length>0 the process is repeated until all strings were removed and the output vector is joined to a string

Ruby, 86 83 bytes

f=->s,v=[]{s.size>0?(s.reject!(&:empty?);f[s.map{_1[1..]},v<<s.map{_1[0]}]):v.join}

Attempt This Online!

A rather naive approach and my first ruby golf.

  • s.reject!(&:empty?) removes all empty strings from the array;

  • s.map{_1[1..]} the first letters are removed;

  • v<<s.map{_1[0]} and added to the output vector;

  • whiles.length>0 the process is repeated recursively until all strings were removed and the output vector is joined to a string.

deleted 4 characters in body
Source Link

Ruby, 8886 bytes

->s{v=[];while s.length>0;ssize>0;s.reject!(&:empty?);v<<s.map{_1[0]};s.map!{_1[1..]}end;v.join}

Attempt This Online!Attempt This Online!

A rather naive approach and my first ruby golf.

  • s.reject!(&:empty?) removes all empty strings from the array;
  • v<<s.map{_1[0]} the first letters are added to the output vector
  • s.map!{_1[1..]} and the first letters are removed
  • while s.length>0 the process is repeated until all strings were removed and the output vector is joined to a string

Ruby, 88 bytes

->s{v=[];while s.length>0;s.reject!(&:empty?);v<<s.map{_1[0]};s.map!{_1[1..]}end;v.join}

Attempt This Online!

A rather naive approach and my first ruby golf.

  • s.reject!(&:empty?) removes all empty strings from the array;
  • v<<s.map{_1[0]} the first letters are added to the output vector
  • s.map!{_1[1..]} and the first letters are removed
  • while s.length>0 the process is repeated until all strings were removed and the output vector is joined to a string

Ruby, 86 bytes

->s{v=[];while s.size>0;s.reject!(&:empty?);v<<s.map{_1[0]};s.map!{_1[1..]}end;v.join}

Attempt This Online!

A rather naive approach and my first ruby golf.

  • s.reject!(&:empty?) removes all empty strings from the array;
  • v<<s.map{_1[0]} the first letters are added to the output vector
  • s.map!{_1[1..]} and the first letters are removed
  • while s.length>0 the process is repeated until all strings were removed and the output vector is joined to a string
deleted 6 characters in body
Source Link
Loading
Source Link
Loading