Skip to content

Instantly share code, notes, and snippets.

View bhargavkulk's full-sized avatar
🎨

Bhargav Kulkarni bhargavkulk

🎨
View GitHub Profile
namespace NatList
-- We define the set of NatLists:
-- 1. nil is a NatList
-- 2. If head is a Nat and tail is NatList
-- then head :: tail is a NatList
inductive NatList: Type
| nil: NatList
| cons (head : Nat) (tail : NatList) : NatList
(FPCore (a b c) (/ (* c -2.0) (+ b (sqrt (+ (pow b 2.0) (* c (* a -4.0)))))))
+-commutative
[ 2, 2, 1 ]
ltr
=========================
(FPCore (a b c) (/ (* c -2.0) (+ b (sqrt (+ (* c (* a -4.0)) (pow b 2.0))))))
*-commutative
[ 1 ]
ltr
=========================
(FPCore (a b c)
(/ 1.0 (/ (/ a (- b (sqrt (fma a (* c -4.0) (pow b 2.0))))) -0.5)))
fma-define
[ 2, 1, 2, 2, 1 ]
ltr
--------------------
(FPCore (a b c)
(/ 1.0 (/ (/ a (- b (sqrt (+ (* a (* c -4.0)) (pow b 2.0))))) -0.5)))
associate-*r*
[ 2, 1, 2, 2, 1, 1 ]
import { strict as assert } from 'node:assert';
const frmla = '(FPCore (a b c):name "quadp (p42, positive)"' +
"(let ([d (sqrt (- (* b b) (* 4 (* a c))))])" +
"(/ (+ (- b) d) (* 2 a))))"
const sample = (await(await fetch('http://127.0.0.1:8000/api/sample', { method: 'POST', body: JSON.stringify({
formula: frmla, seed: 5 }) })).json())
const SAMPLE_SIZE = 8000
@bhargavkulk
bhargavkulk / pool.cpp
Created March 1, 2022 06:38
dsa pool question
#include <iostream>
#include <vector>
using namespace std;
using Matrix = vector<vector<int>>;
int i = 1;
void recur(Matrix &matrix, int cx, int cy, int size, int px, int py) {
pub mod editor;
pub mod events;
pub mod row;
use std::path::PathBuf;
use crossterm::Result;
use editor::Editor;
use log::LevelFilter;
use simple_logging;
main: test.y test.l
bison -d test.y
flex test.l
gcc -o $@ main.c test.tab.c lex.yy.c -lfl
@echo "Compiled main."
#include "test.tab.h"
int main()
{
yyparse();
return 0;
}
@bhargavkulk
bhargavkulk / bot.py
Created July 10, 2021 16:22
D.GG archiver bot o7
import tweepy
from datetime import date
from pprint import pprint
import re
import json
import os
user_id = "TheOmniLiberal"
@bhargavkulk
bhargavkulk / sen1answers.sql
Created February 25, 2021 15:14
Scenario 1 answers lab 4
-- 1
select ssid
from students
order by marks desc
limit 1 offset 1;
-- 2
select branch, count(branch)
from students
group by branch