Install MLX LM:
pip install mlx-lm
And run:
(ns dual-math | |
(:refer-clojure :exclude [+ - * / abs max min sin cos tan asin acos atan exp log pow sqrt]) | |
(:require [clojure.core :as core])) | |
;; == Part 1: Dual Number Definition and Helpers == | |
(defrecord DualNumber [value deriv]) | |
;; Helper to check if something is a dual number | |
(defn dual? [x] (instance? DualNumber x)) |
import anthropic | |
import os | |
import sys | |
from termcolor import colored | |
from dotenv import load_dotenv | |
class ClaudeAgent: | |
def __init__(self, api_key=None, model="claude-3-7-sonnet-20250219", max_tokens=4000): | |
"""Initialize the Claude agent with API key and model.""" |
(ns tree-generator | |
(:require [clojure.java.io :as io] | |
[clojure.string :as str])) | |
(defn relative-path | |
"Computes the relative path of a file with respect to a base directory." | |
[base file] | |
(let [base-path (.getCanonicalPath base) | |
file-path (.getCanonicalPath file) | |
prefix (str base-path "/")] |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Candlestick Chart</title> | |
<style> | |
/* Basic styles for the container and canvas */ | |
body { | |
font-family: 'Arial', sans-serif; |
Objective: Develop a Clojure application using REPL-driven development. | |
Instructions: | |
Start with small, fundamental functions: | |
Identify the core features or functionalities required for your application. | |
Break each feature down into the smallest, most basic functions that can be developed and tested independently. | |
Write and test in the REPL: | |
Write the code for each small function directly in the REPL (Read-Eval-Print Loop). | |
Test it thoroughly with a variety of inputs, including typical use cases and relevant edge cases, to ensure it behaves as expected. |
import json | |
import logging | |
import asyncio | |
import websockets | |
from typing import Dict, List, Optional, Set | |
from datetime import datetime | |
import hmac | |
import base64 | |
import time | |
import redis |
Understand the Task: Grasp the main objective, goals, requirements, constraints, and expected output. | |
- Minimal Changes: If an existing prompt is provided, improve it only if it's simple. For complex prompts, enhance clarity and add missing elements without altering the original structure. | |
- Reasoning Before Conclusions: Encourage reasoning steps before any conclusions are reached. ATTENTION! If the user provides examples where the reasoning happens afterward, REVERSE the order! NEVER START EXAMPLES WITH CONCLUSIONS! | |
- Reasoning Order: Call out reasoning portions of the prompt and conclusion parts (specific fields by name). For each, determine the ORDER in which this is done, and whether it needs to be reversed. | |
- Conclusion, classifications, or results should ALWAYS appear last. | |
- Examples: Include high-quality examples if helpful, using placeholders [in brackets] for complex elements. | |
- What kinds of examples may need to be included, how many, and whether they are complex enough to benefit from p |
import java.nio.ByteBuffer; | |
import java.nio.DoubleBuffer; | |
public class UnsafeNN implements NN { | |
private final double[] z1; | |
private final double[] z2; | |
private final ByteBuffer bb; | |
private final DoubleBuffer db; | |
private final double[] o; |
const ctx = []; | |
function addEffect(current, effects) { | |
effects.add(current); | |
current.deps.add(effects); | |
} | |
function createAtom(value) { | |
const effects = new Set(); |