Skip to content

Instantly share code, notes, and snippets.

View allquantor's full-sized avatar
:shipit:
.

Ivan Morozov allquantor

:shipit:
.
View GitHub Profile
@allquantor
allquantor / UnionSequence.scala
Created December 28, 2016 21:03
Disjoint set DS
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)
}
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> {
### 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:
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) {
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
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}
-- 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;
-- 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;
-- 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
{-
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