Skip to content

Instantly share code, notes, and snippets.

View kevin-lee's full-sized avatar
🏠
Working from home

Kevin Lee kevin-lee

🏠
Working from home
View GitHub Profile
@bishboria
bishboria / springer-free-maths-books.md
Last active March 22, 2024 11:19
Springer made a bunch of books available for free, these were the direct links
@retronym
retronym / indylambda.md
Last active February 5, 2022 10:47
indylambda: Putting invokedynamic to work for Scala

indylambda: Putting invokedynamic to work for Scala

Java 8 introduced lambdas to the Java language. While the design choices differ in many regards from Scala's functions, the underlying mechanics used to represent Java lambdas is flexible enough to be used as a target for the Scala compiler.

Lambdas in Java

Java does not have canonical heirarchy of generic function types (ala scala.FunctionN), but instead allows a lambda to be used as a shorthand for an anonymous implementation of an Functional Interface

Here's an example of creating a predicate that closes over one value:

@odersky
odersky / equality.scala
Last active October 6, 2018 18:56
Better equality for Scala
import annotation.unchecked.uncheckedVariance
/** The trait of things that can be compared safely */
trait Equals[-T] {
/** A witness of Equals' type parameter. Should only used for
* the constraint in EqlDecorator, hence, @uncheckedVariance should not be a problem.
*/
type EqualsDomain = T @uncheckedVariance
@kevin-lee
kevin-lee / LookAndSaySequenceExample.java
Created September 8, 2012 18:48
Look-and-say sequence examples written in Java (by Kevin) / Please visit http://goo.gl/X94gN for more details.
package com.lckymn.kevin.example;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Visit http://goo.gl/X94gN for more details.
*
* @author Lee, SeongHyun (Kevin) / <a href="http://blog.lckymn.com">Kevin&apos;s Blog</a>