I hereby claim:
- I am ttim on github.
- I am tabishev (https://keybase.io/tabishev) on keybase.
- I have a public key whose fingerprint is BA06 2B45 8F59 9FD3 41BF FDC7 6F00 D057 5190 08B2
To claim this, I am signing this object:
In response to all the responses to: | |
http://twitter.com/rtomayko/status/1155906157 | |
You should never do this in a source file included with your library, | |
app, or tests: | |
require 'rubygems' | |
The system I use to manage my $LOAD_PATH is not your library/app/tests |
package ru.abishev; | |
import java.io.ByteArrayOutputStream; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
import java.net.MalformedURLException; | |
import java.net.URL; |
I hereby claim:
To claim this, I am signing this object:
case class M[A](value: A, list: List[String]) { | |
def flatMap[B](f: A => M[B]): M[B] = { | |
f(value) match { | |
case M(value2, list2) => M(value2, list ++ list2) | |
} | |
} | |
def map[B](f: A => B): M[B] = M(f(value), list) | |
} | |
def pureM[A](a: A): M[A] = M(a, List()) |
object StacklessRecursion { | |
type TrampolineK[B[_]] = ({ type Trampolined[T] = Trampoline[B[T]] })#Trampolined | |
def computeK[A[_], B[_], T]( | |
f: RecursiveK[A, TrampolineK[B]], | |
maxStack: Int = 100 | |
)(value: A[T]): B[T] = ??? | |
} |
package com.twitter.scalding | |
import scala.util.control.TailCalls | |
import scala.util.control.TailCalls.TailRec | |
object StacklessRecursion { | |
type Rec[A, B] = (A, A => TailRec[B]) => TailRec[B] | |
def computeNonSafe[A, B](rec: Rec[A, B])(value: A): B = { | |
def compute(value: A): TailRec[B] = rec(value, compute) |
Got inspired by https://erik-engheim.medium.com/source-code-of-python-and-julia-compared-7895202e8cb2 and compared couple more languages CLOCs. I did top ~3 for each + total.