Why is it that there is anOption.expect(M)
, but noResult.expect(M)
?
I opened a pull request [pr] which put this in, and it turns out the reason there is no expect
function is because you are intended to use composition:
Why is it that there is anOption.expect(M)
, but noResult.expect(M)
?
I opened a pull request [pr] which put this in, and it turns out the reason there is no expect
function is because you are intended to use composition:
# Copyright 2020 by Joshua "Skrylar" Cearley, | |
# Available under the Mozilla Public License, version 2.0, | |
# https://www.mozilla.org/en-US/MPL/2.0/ | |
import macros | |
import strformat | |
import sugar | |
macro make_postbox*(name, body: untyped): untyped = | |
# validate body of our macro |
# TODO protect fields with inline procs that should get optimized out in release builds, but in debug builds can do asserts to make sure you unlocked it first | |
import opengl | |
import macros | |
import skyhash/xxhash | |
import sklog | |
type | |
TextureParameterBrush* = object | |
xhash*: uint64 |
#- = Making a stack-based parameter system | |
#- | |
#- I wanted to know how `chronicle` 's stack-based parameter system for | |
#- logs could work. So I pulled this out of a description of it on their | |
#- README. No spoilers were read beforehand. | |
#- | |
#- Here's how it works: | |
#- | |
#- . Marker objects are defined to hold information relevant from that | |
#- level of the stack downward. |
import printingpress | |
import skmap/robin | |
import math | |
type | |
FlowDirection* = enum | |
LeftToRight | |
TopToBottom |
from math import sqrt | |
from tqdm import tqdm | |
from random import random | |
import matplotlib | |
from matplotlib import pyplot as plt | |
point_count = 20 | |
zoop = [0]*2048 | |
points = [0]*point_count |
import libcurl | |
const | |
feed = "https://feeds.feedburner.com/breitbart?format=xml" | |
var downloaded = newstringofcap(1024) | |
proc onwrite(buffer: cstring; size, nitems: int; outstream: pointer): int = | |
let total = size * nitems | |
for i in 0..<total: | |
downloaded.add buffer[i] |
# not sure why this isn't built-in | |
template inc(self: var float; other: float) = | |
self = self + other | |
type | |
Averager* = object | |
count: int | |
x: float | |
proc feed*(self: var Averager; value: float) = |
var cobweb = Cobweb() | |
cobweb.def_root(inflation, float) | |
cobweb.def_root(monies, float) | |
cobweb.def_root(transhumanity, bool) | |
cobweb.def rich, bool: | |
result(monies): | |
monies > 1000000 |
import macros | |
macro fsm*(name, definition: untyped): untyped = | |
echo treeRepr definition | |
fsm butt: | |
# default actions are taken when getting an input without that state | |
# knowing what to do about it | |
default: |