Quantcast
Channel: Write a Stack Exchange compliant brainfuck explainer - Code Golf Stack Exchange
Viewing all articles
Browse latest Browse all 17

Answer by Radek for Write a Stack Exchange compliant brainfuck explainer

$
0
0

Haskell, 235 231 bytes

import Data.Listmain=interact$unlines.map("    "++).f"><+-.,[]".linesf o(i:e)|let t=not.(`elem`o);p=(>>" ").concat;w((c:r):t)=(c:r++p t++'':maybe(e!!8)id(lookup c$zip o e)):[p[c:r]++l|l<-w t];w[]=[]=i:w(groupBy(\x y->t x&&t y)i)

Try it online!

Old answer:

Haskell, 235 bytes

import Data.Listmain=interact$unlines.map("    "++).f.lineso="><+-.,[]"t=not.(`elem`o)p=(>>" ").concatf(i:e)|let w((c:r):t)=(c:r++p t++'':maybe(last e)id(lookup c$zip o e)):[p[c:r]++l|l<-w t];w[]=[]=i:(w$groupBy(\x y->t x&&t y)i)

Try it online!

The answer is not final, will probably be golfed further.


Viewing all articles
Browse latest Browse all 17

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>