This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| relative_require "record" | |
| class Record | |
| record :a, :b | |
| end | |
| a = Record.new(a: 10, b: 20) | |
| a = a.merge(b: 10) | |
| p a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <stdbool.h> | |
| #define BUFFER_CAPACITY 10 | |
| #define DEFAULT_BUFFER { \ | |
| calloc(BUFFER_CAPACITY, sizeof(char)), \ | |
| BUFFER_CAPACITY, \ | |
| } \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule Monoid do | |
| defmacro __using__(_opts) do | |
| quote do | |
| def concat([head|tail]) do | |
| append(head, concat(tail)) | |
| end | |
| def concat([]) do | |
| empty |