Are you proud of your code, /g/?
>>54459001
sometimes.
>>54459001
>memescript
>>54459001
MA WHAS FO DINNA?
SPAGHETTI SON SPAGHETTI!
>>54459009
He doesn't even use it to its full extent.
>>54459001
>var length = array.length;
OAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
>>54459001
Not exactly but it works atleast
>>54459001
If it works and you save a bunch of time then who gives a fuck. Unless it's a big project then you fuck every one over including future you.
>>54459019
>var length = array.length;
I do this to avoid calling the length function a gorillion times in a loop.
Never checked if there was actually any difference in performance.
>>54459001
Some of it. Maybe.
>>54459019
bait? bait
>>54459021
Please put your opening bracket on the same line as do.
t. K&R
>>54459001
>Are you proud of your code, /g/?
Never.
No but I usually write quick and dirty because I have so many things to do
Always revise it later
>>54459001
Verysed :: [String] -> String -> Memory (Message String)
sed _ ('s':x:xs) = do
let f :: (Bool, (Int, ((String, String), String)))
-> Char
-> (Bool, (Int, ((String, String), String)))
f (True, (n, ((a, b), c))) x'
| n == 1 && x' == x = (False, (n, ((a ++ [x'], b), c)))
| n == 1 = (False, (n, ((a ++ ['\\', x'], b), c)))
| n == 2 && x' == x = (False, (n, ((a, b ++ [x']), c)))
| n == 2 = (False, (n, ((a, b ++ ['\\', x']), c)))
| otherwise = (False, (n, ((a, b), c ++ ['\\', x'])))
f (False, (n, ((a, b), c))) x'
| n == 1 && x' == x = (False, (2, ((a, b), c)))
| n == 1 && x' == '\\' = (True, (n, ((a, b), c)))
| n == 1 = (False, (n, ((a ++ [x'], b), c)))
| n == 2 && x' == x = (False, (3, ((a, b), c)))
| n == 2 && x == '\\' = (True, (n, ((a, b), c)))
| n == 2 = (False, (n, ((a, b ++ [x']), c)))
| otherwise = (False, (n, ((a, b), c ++ [x'])))
(_, (_, ((match, replacement), string))) = foldl f (False, (1, (("", ""), ""))) xs
(ins, _:string') = break (== ' ') string
insensitive = ins /= "i"
regex = mkRegexWithOpts match False insensitive
liftIO $ print insensitive
e <- liftIO $ try (return $! subRegex regex string' replacement) :: Memory (Either SomeException String)
case e of
Right a -> return $ ChannelMsg a
Left e -> return EmptyMsg
sed _ _ = return EmptyMsg
It works and that is enough.
>>54459271
For some reason I never looked back to my older code and noticed that I improved anything or that it sucked in the first place. Probably because it was trivial, but still. I've only been doing this for the past year or so.
The only absolutely disgusting thing I did was when I wrote some small web scraper in python and didn't bother learning how to make a proper global, so I just passed one variable from function to function kek. I don't even know...
How can I see when I am improving the code anyway?
>>54459376
Ignore the quote from another thread. I'm a mobileposter.
>>54459001
I always make an effort to make my code as high quality as possible.
Re-factoring is one of my favourite things to do.
>>54459065
There is
>>54459354
8/10 job security theyll keep you around for decades to maintain that pile o shit.
>>54459412
it's true
if you can convince companies to use functional programming, you can keep your job
jimplush.com/talk/2015/12/19/moving-a-team-from-scala-to-golang/
look at thisimport scalaz._
import scalaz.std.list._
import scalaz.syntax.monad._
import scalaz.syntax.monoid._
import scalaz.syntax.traverse.{ToFunctorOps => _, _}
class Foo[F[+_] : Monad, A, B](val execute: Foo.Request[A] => F[B], val joins: Foo.Request[A] => B => List[Foo.Request[A]])(implicit J: Foo.Join[A, B]) {
def bar: Foo[({type l[+a]=WriterT[F, Log[A, B], a]})#l, A, B] = {
type TraceW[FF[+_], +AA] = WriterT[FF, Log[A, B], AA]
def execute(request: Request[A]): WriterT[F, Log[A, B], B] =
self.execute(request).liftM[TraceW] :++>> (repr => List(request -> request.response(repr, self.joins(request)(repr))))
----- REDACTED -------