Skip to content

Instantly share code, notes, and snippets.

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:

/// 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;
}
@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 [email protected]
Implementation: (links to implementation PR if any)
Status: Will be set by the DIP manager (e.g. "Approved" or "Rejected")
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 / 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;
struct MyRange<Type> {
@property {
Type delegate() front;
bool delegate() empty;
}
void delegate() popFront;
@implicit static auto opCall(T)(T from) {
MyRange!(Type: T.Type) ret;
@rikkimax
rikkimax / Tasks.md
Last active May 5, 2018 10:44
dmd as a library task list
  • Move into a utility sub package:
    • dmd.console
    • dmd.entity
    • dmd.utf
    • dmd.root.array
    • dmd.root.hash
    • dmd.root.outbuffer
    • dmd.root.stringtable
  • dmd.errors
  • Make wrappers switch to D's variadic arguments

The language is composed of types, literals and statements. Types are a definition of what a literal can be.

Literals are:

- Number
- String
- Function body with prototype
- Reference to variable
- Initialized template
- Comment
@rikkimax
rikkimax / patch.diff
Created December 26, 2017 12:37
drag&drop for dplug:window X11+WinAPI
From 5d08d297b12a2d4374a22e1515f72e68b6f990ba Mon Sep 17 00:00:00 2001
From: rikki cattermole <[email protected]>
Date: Mon, 18 Dec 2017 00:40:09 +1300
Subject: [PATCH] Windows & X11 support for drag&drop
---
examples/window/main.d | 25 +++-
gui/dplug/gui/graphics.d | 10 ++
window/dplug/window/win32window.d | 59 ++++++++-
window/dplug/window/window.d | 6 +
///
module engine.math.vector;
import std.traits : isBasicType, isFloatingPoint;
struct Vector(Type, size_t Dimension)
if ((isBasicType!Type || isFloatingPoint!Type) && Dimension > 0) {
nothrow:
private {
import simd = core.simd;