Skip to content

Instantly share code, notes, and snippets.

View imclerran's full-sized avatar
🚀

Ian McLerran imclerran

🚀
View GitHub Profile
@imclerran
imclerran / NumUtils.roc
Created May 7, 2026 01:46
Flaky test results example
## Numeric utility functions for working with floating-point values.
##
## In particular, [is_approx_eq] and [is_approx_eq_to_places] provide
## IEEE 754-style hybrid (absolute + relative) tolerance comparison
NumUtils :: [].{
## Test whether two F64 values are approximately equal, using a hybrid of
## absolute and relative tolerance
##
## |a - b| <= max(abs_tol, rel_tol * max(|a|, |b|))
@imclerran
imclerran / repro.roc
Last active January 29, 2025 17:15
String garbling reproduction - free endpoint / no roc-ai dependency
app [main!] {
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br",
json: "https://github.com/lukewilliamboswell/roc-json/releases/download/0.12.0/1trwx8sltQ-e9Y2rOB4LWUWLS_sFVyETK8Twl0i9qpw.tar.gz",
}
import cli.Http
import cli.Stdout
import json.Json
main! = |_|
@imclerran
imclerran / garble.roc
Last active January 27, 2025 16:52
List destructuring w/ Stdout - garbled output bug
app [main!] {
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/bi5zubJ-_Hva9vxxPq4kNx4WHX6oFs8OP6Ad0tCYlrY.tar.br",
ai: "https://github.com/imclerran/roc-ai/releases/download/v0.9.0/LIMYIvGIjaL4cbOXI6mgjV5pQEdNVE5w_G8ggz1uxGU.tar.br",
}
import ai.Chat
import cli.Env
import cli.Http
import cli.Stdout
@imclerran
imclerran / ParseIso.roc
Last active April 30, 2024 08:28
Get time from API and parse using Roc IsoDate
app "parse-iso"
packages {
pf: "https://..",
dt: “../package/main.roc
}
imports [
pf.Http,
pf.Task.{ Task },
pf.Stdout,
dt.DateTime,
group:ex3
--
Sailor = {
Sid:number,sname:string,rating:number,age:number
22,dustin,7,45
29,Brutus,1,33
31,lubber,8,50
32,Andy,8,20
58,rusty,10,34
@imclerran
imclerran / hw3-dataset
Last active February 10, 2018 00:45
relax dataset for cs451 hw3
-- this is an example
group: homework3
Customers = {
cid:string, cname:string, city:string
c1, John, Pullman
c2, Alli, Pullman
c3, Kelly, Moscow