Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am otaconix on github.
  • I am otaconix (https://keybase.io/otaconix) on keybase.
  • I have a public key ASB6sLKRThG0ZXgFiWzwS3oPBDH0xrARP-g8-iGviTbCywo

To claim this, I am signing this object:

@otaconix
otaconix / cond.io
Last active February 26, 2017 03:11
cond construct
rand := (Random value * 99 + 1) round
rand println
cond := method(
if(call message argCount % 2 != 0, Exception raise("cond needs pairs of arguments (arg count: #{call message argCount})" interpolate));
inner := method(c, i,
if (i >= c message argCount, Exception raise("cond needs at least one condition to be true"));
if (c evalArgAt(i), return c evalArgAt(i + 1), return inner(c, i + 2)))
@otaconix
otaconix / map.io
Created February 26, 2017 00:35
Works in Io REPL, doesn't in doFile()
OperatorTable addAssignOperator("=>", "atPutRemoveQuotes")
curlyBrackets := method(
r := Map clone;
call message arguments foreach(arg, r doMessage(arg));
r
)
Map atPutRemoveQuotes := method(
self atPut(