Skip to main content
deleted 6 characters in body
Source Link
rydwolf
  • 19.3k
  • 2
  • 90
  • 180

JavaScript (ES6), 145129 bytes

b=>[...b].map(x=>p+=[A="=+"x=>p+="=+,"+"+,B="=>"=>,">">,C="=|"=|,"|"|,D="=="==,C+C=|=|,"+"+,A=+,">">,B=>,"|"|,C=|,D==,"|=|"]["+|=|".split`,`["+-><[].,".indexOf(x)+p.split`=`.length%2*8],p="")&&p 

Uses an array of the 16 possibilities (8 characters times 2 parities), and indexes into this (that. The array is built by splitting a string, which saves three26 bytes over a 2dan array, which is what I was using).

JavaScript (ES6), 145 bytes

b=>[...b].map(x=>p+=[A="=+","+",B="=>",">",C="=|","|",D="==",C+C,"+",A,">",B,"|",C,D,"|=|"]["+-><[].,".indexOf(x)+p.split`=`.length%2*8],p="")&&p 

Uses an array of the 16 possibilities (8 characters times 2 parities), and indexes into this (that saves three bytes over a 2d array, which is what I was using).

JavaScript (ES6), 129 bytes

b=>[...b].map(x=>p+="=+,+,=>,>,=|,|,==,=|=|,+,=+,>,=>,|,=|,==,|=|".split`,`["+-><[].,".indexOf(x)+p.split`=`.length%2*8],p="")&&p 

Uses an array of the 16 possibilities (8 characters times 2 parities), and indexes into this. The array is built by splitting a string, which saves 26 bytes over an array.

Source Link
rydwolf
  • 19.3k
  • 2
  • 90
  • 180

JavaScript (ES6), 145 bytes

b=>[...b].map(x=>p+=[A="=+","+",B="=>",">",C="=|","|",D="==",C+C,"+",A,">",B,"|",C,D,"|=|"]["+-><[].,".indexOf(x)+p.split`=`.length%2*8],p="")&&p 

Uses an array of the 16 possibilities (8 characters times 2 parities), and indexes into this (that saves three bytes over a 2d array, which is what I was using).