Skip to content

Instantly share code, notes, and snippets.

@rikkimax
rikkimax / headconst.d
Last active September 25, 2018 01:35
import std.stdio;
void main()
{
auto a = HeadConst!(int*)(new int);
a = 3;
assert(a == 3);
auto b = HeadConst!(int[])(new int[3]);
b[0] = 1;
enum AllKeyModifiers = [KeyModifiers.LAlt, KeyModifiers.RAlt, KeyModifiers.LControl, KeyModifiers.RControl,
KeyModifiers.LShift, KeyModifiers.RShift, KeyModifiers.Capslock, KeyModifiers.Numlock,
KeyModifiers.LSuper, KeyModifiers.RSuper];
enum AllVirtualKeyModifiers = [VK_LMENU, VK_RMENU, VK_LCONTROL, VK_RCONTROL, VK_LSHIFT,
VK_RSHIFT, VK_CAPITAL, VK_NUMLOCK, VK_LWIN, VK_RWIN];
uint addKeyModifiersStart(INPUT[] inputs, ushort modifiersToDown, ushort modifiersToUp, ushort currentState) {
uint count;
// we should only press a key down if it already isn't pressed
@rikkimax
rikkimax / dip.md
Last active November 23, 2018 14:02
signature overall description

Signature type

Field Value
DIP: (number/id -- assigned by DIP Manager)
Review Count: 0 (edited by DIP Manager)
Author: Richard Andrew Cattermole firstname@lastname.co.nz
Implementation: (links to implementation PR if any)
Status: Will be set by the DIP manager (e.g. "Approved" or "Rejected")
/// https://en.wikipedia.org/wiki/Activation_function
module stage2.nn.activationfunctions;
import std.math : exp, pow, E, tanh, atan, abs, sqrt, log, sin, cos, PI;
struct ActivationFunction {
double function(double x, double arg) activation;
double function(double x, double arg) derivative;
double arg;
}

Market Research

The only image library that could be found for the SML programming language.

Pros:

  • Fairly standard design.
  • Uses signature to place reading of a PNG on to an input stream.

Cons:

/**
* LV2 Client implementation
*
* Copyright: Ethan Reker 2018.
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
*/
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2018 Filipe Coelho <falktx@falktx.com>
@rikkimax
rikkimax / points.md
Last active April 4, 2019 18:47
DIP 1020 review 1
  • Angle brackets, may be hard to find given relationship with templates Potential solutions include @named
  • External access of template parameters externally needs justification
  • Interaction with eponymous templates, invalid
  • "Future proposals" sections should probably have a full rewrite to indicate its for recognizing desirable semantics that are out of scope.
  • Not in competition with in place struct initialization, different purposes
  • More headings (break down behavior)
  • Reorder of arguments does not change at symbol site, only at the argument side
  • Overload resolution code is flawed with illegal code
  • Compare and contrast example code
import wg.util.allocator;
import std.traits : isPointer, isBasicType;
struct Optional(T) if (isBasicType!T || is(T == struct) || is(T == union)) {
@disable this(this);
this(Allocator* allocator) {
this.allocator = allocator;
}

TODO: some form of introductory paragraph about what goes under this

Requirements

Use cases

Semantics

Named parameters

Field Value
DIP: 1020
Review Count: 1
Author: Richard Andrew Cattermole firstname@lastname.co.nz
Implementation:
Status: Post-Community 1