This file contains 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
import scala.language._ | |
// https://en.wikipedia.org/wiki/Disjoint-set_data_structure | |
// Not optimized version | |
// Supports only integer element sequences starting with 0, where n1 - n2 = -1 | |
object UnionSequence { | |
def apply(elems: Int*): UnionSequence = { | |
new UnionSequence(Array(elems:_*) toIndexedSeq) | |
} |
This file contains 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
import java.util.function.Function; | |
public interface Functor<T, F extends Functor<?,?>> { | |
<R> F map(Function<T,R> f); | |
} | |
import java.util.function.Function; | |
public abstract class Monad<F, M extends Monad<?, ?>> implements Functor<F, M> { |
This file contains 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
### Keybase proof | |
I hereby claim: | |
* I am allquantor on github. | |
* I am allquantor (https://keybase.io/allquantor) on keybase. | |
* I have a public key ASDLiMeVjPjBE92VGIo4aGRukCDk5zxUtywfDkgBdMVyJwo | |
To claim this, I am signing this object: |
This file contains 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
function createSheetsByPromptId() { | |
// Configurable parameters | |
var minimumFilledEntries = 50; | |
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); | |
var sheet = spreadsheet.getActiveSheet(); // get current sheet | |
// get entire data range | |
var data = sheet.getDataRange().getValues(); | |
var header = data[0].map(function(name) { |
This file contains 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
import json | |
import urllib | |
from django.conf import settings | |
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseRedirect | |
from django.urls import reverse | |
from django.utils import timezone | |
from rest_framework.renderers import TemplateHTMLRenderer | |
from rest_framework.response import Response | |
from rest_framework.views import APIView |
This file contains 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
package co.upvest.martind | |
import co.upvest.terminology.adjectives.common._ | |
import co.upvest.terminology.adjectives.implicits._ | |
import co.upvest.dry.essentials._ | |
import co.upvest.dry.essentials.syntax._ | |
import co.upvest.dry.catz.syntax._ | |
import co.upvest.dry.{gstorage => gs} | |
import co.upvest.dry.service.{UpvestMsgId, Flogging} |
This file contains 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
-- 1. Function Definition | |
CREATE OR REPLACE FUNCTION fetch_reverse_data(addr text) | |
RETURNS text LANGUAGE plpgsql AS $$ | |
DECLARE | |
enc_addr_hex text; | |
body text; | |
response text; | |
name_off bigint; | |
name_len bigint; |
This file contains 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
-- 1. Function Definition | |
CREATE OR REPLACE FUNCTION fetch_reverse_data(addr text) | |
RETURNS text LANGUAGE plpgsql AS $$ | |
DECLARE | |
enc_addr_hex text; | |
body text; | |
response text; | |
name_off bigint; | |
name_len bigint; |
This file contains 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
-- Define the MAMonadContent type class | |
class MAMonadContent a where | |
extractKeys :: LLM -> a -> IO [Key] | |
-- Define the MAMonad type | |
newtype MAMonad a = MAMonad { runMAMonad :: IO a } | |
instance Functor MAMonad where | |
fmap f (MAMonad a) = MAMonad $ fmap f a |
This file contains 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
{- | |
MAMonad: | |
- A monadic structure, MAMonad, designed to abstract over various content types (e.g., Video, Audio, Text) and facilitate transformations between them using a Large Language Model (LLM). | |
- Type: MAMonad :: * -> * | |
Bifunctor-like Error Handling: | |
- MAMonadResult is a bifunctor-like structure encapsulating either a result (Success) or an error (Error). | |
- Type: MAMonadResult a b = Success a | Error b |
OlderNewer