Skip to content

Instantly share code, notes, and snippets.

View run-dlang's full-sized avatar

Eleanor Cross run-dlang

View GitHub Profile
@run-dlang
run-dlang / main.d
Created October 2, 2023 21:30
Code shared from run.dlang.io.
import std;
struct Color {
ubyte r;
ubyte g;
ubyte b;
ubyte a;
}
enum Colors : Color
@run-dlang
run-dlang / main.d
Created October 2, 2023 18:01
Code shared from run.dlang.io.
import std;
int mod(int dividend, int divisor){
return dividend % divisor;
}
void main()
@run-dlang
run-dlang / main.d
Created October 1, 2023 20:48
Code shared from run.dlang.io. Run with '-unittest -main'
import std;
//https://leetcode.com/problems/find-greatest-common-divisor-of-array/
enum test1=[2,5,6,9,10];
enum test2=[7,5,6,8,3];
enum test3=[3,3];
auto gcdarray_verbose(R)(R r){
auto mi=r.minElement;
auto mx=r.maxElement;
return gcd(mi,mx);
@run-dlang
run-dlang / main.d
Created October 1, 2023 20:48
Code shared from run.dlang.io. Run with '-unittest -main -mixin=mix'
import std;
//https://leetcode.com/problems/find-greatest-common-divisor-of-array/
enum test1=[2,5,6,9,10];
enum test2=[7,5,6,8,3];
enum test3=[3,3];
auto gcdarray_verbose(R)(R r){
auto mi=r.minElement;
auto mx=r.maxElement;
return gcd(mi,mx);
@run-dlang
run-dlang / main.d
Created October 1, 2023 20:46
Code shared from run.dlang.io. Run with '-unittest -main -mixin=mix'
import std;
//https://leetcode.com/problems/find-greatest-common-divisor-of-array/
enum test1=[2,5,6,9,10];
enum test2=[7,5,6,8,3];
enum test3=[3,3];
auto gcdarray_verbose(R)(R r){
auto mi=r.minElement;
auto mx=r.maxElement;
return gcd(mi,mx);
@run-dlang
run-dlang / main.d
Created October 1, 2023 17:22
Code shared from run.dlang.io. Run with '-unittest'
/+dub.sdl:
dependency "collections" version="~>0.1.0"
+/
void main()
{
import std.traits;
import std.stdio: write, writeln, writef, writefln;
#line 1
static assert(fullyQualifiedName!fullyQualifiedName == "std.traits.fullyQuhalifiedName");
@run-dlang
run-dlang / main.d
Created September 30, 2023 09:20
Code shared from run.dlang.io.
import std.stdio;
import core.thread;
struct Player {
int number;
void parallel_op() {
writefln("match %s has begun", number);
// Wait for a while to simulate a long-lasting operation
@run-dlang
run-dlang / main.d
Created September 29, 2023 18:01
Code shared from run.dlang.io.
import std.stdio, std.format;
import std.algorithm;
struct BoolMatrix(int n)
{
 bool[n][n] elements;
 enum err1 = n.format!"Point, %s'e denk veya fazla olamaz!";
 ref opCall(Point i)
@run-dlang
run-dlang / main.d
Created September 29, 2023 14:56
Code shared from run.dlang.io.
import std.stdio;
void main()
{
int[] a = [1, 2, 3, 4];
char[] nameN = ['J', 'O', 'H', 'N'] ~ [' ', 'D', 'O', 'E'];
char e = 'E';
char lettreE = 'E';
float D = 343;
double O = D + 322 / 1.5;
@run-dlang
run-dlang / main.d
Created September 29, 2023 13:04
Code shared from run.dlang.io.
import std;
void outofcontext()
{
writeln("Hello D ", associative);
foreach (pointeraddress, information; associative)
{
writeln(*cast(string*)pointeraddress);
}