In the VM properties, make two connections: a "NAT" for regular internet connectivity, and a "host-only" for ssh connectivity between host and guest with a predictable IP. For this to work, both a NAT adapter and a host-only adapter have to be created in the host via the VirtualBox global preferences.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Jaffar, the Evil Advisor Library | |
# | |
# This is a simple experiment in Ruby metaprogmming, to see how to implement | |
# a lisp-style advising construct. Advising is basically augmenting existing | |
# functions with your own code. See the exemple below. | |
# | |
# Advising is very much related to context-oriented programming. I fortunately | |
# have no use for either an advising or context-oriented programming right now | |
# and this is why I did not expand upon this simple implementation. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package util; | |
import java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.Method; | |
/** | |
* This class implements multiple dispatch (aka multimethods) using reflection. | |
* The idea is to choose the method based not only on the runtime type of the | |
* receiver, but also on the runtime type of the arguments. Normally Java | |
* selects amongst overloaded alternatives using the static type. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Basic setup | |
interface Exp | |
data class Lit(val x: Int): Exp | |
data class Add(val x: Exp, val y: Exp): Exp | |
interface IntAlg<A> | |
{ | |
fun lit(x: Int): A | |
fun add(x: A, y: A): A |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Basic setup | |
interface Exp | |
data class Lit(val x: Int): Exp | |
data class Add(val x: Exp, val y: Exp): Exp | |
val exp0 = Add(Lit(42), Lit(0x52)) | |
// Adding a print operation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline fun <T, U> (() -> T?).map (crossinline f: (T) -> U): (() -> U?) | |
{ | |
return { this()?.let(f) } | |
} | |
inline fun <T> (() -> T?).filter (crossinline pred: (T) -> Boolean): (() -> T?) | |
{ | |
return { | |
var out = this() | |
while (out != null && !pred(out)) out = this() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am norswap on github. | |
* I am norswap (https://keybase.io/norswap) on keybase. | |
* I have a public key whose fingerprint is CB7E 4E0F F8C0 2860 6A62 55F2 A7E2 9E43 45FB 1D8E | |
To claim this, I am signing this object: |
Install homebrew then run brew install swi-prolog
.
You can now run the Prolog shell from the command line with swipl
.
Important: do not install from the official website, you will get crashes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package demo; | |
public interface Node {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final class Visitors | |
{ | |
// --------------------------------------------------------------------------------------------- | |
// 1. Initial setup. | |
interface Visitor { | |
void visit (A object); | |
void visit (B object); | |
} |
OlderNewer