This file contains hidden or 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
; vim: syntax=clojure | |
;Updated based on much feedback on proper smart contract logic construction with Gemini 2.0 Flash Experimental | |
(defn create-dutch-auction [] | |
(deploy | |
`(do | |
(import convex.asset :as asset) | |
(import asset.nft.tokens :as nft) | |
(def auctions {}) |
This file contains hidden or 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
;; *clojure-version* | |
;; (require '[taoensso.encore :as encore]) | |
(let [v [1 2 3 4] | |
x 1 | |
y 2 | |
z 3] | |
(encore/qbench ; Returns fastest of 3 sets of lap times for each form, in msecs | |
1000000 ; Number of laps |
This file contains hidden or 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
(use '[clojure.core.match :only [match]]) | |
(defn evaluate [env [sym x y]] | |
(match [sym] | |
['Number] x | |
['Add] (+ (evaluate env x) (evaluate env y)) | |
['Multiply] (* (evaluate env x) (evaluate env y)) | |
['Variable] (env x))) | |
(def environment {"a" 3, "b" 4, "c" 5}) |
This file contains hidden or 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
;; enodyt's solution to Game of Life | |
;; https://4clojure.com/problem/94 | |
(fn [board] | |
(let [dx (count (first board)) | |
dy (count board) | |
neighbours (fn [pos board] | |
(let [xs [[-1 -1] [0 -1] [1 -1] | |
[-1 0] [1 0] | |
[-1 1] [0 1] [1 1]]] |