{"id":17931751,"url":"https://github.com/noti0na1/racket-codes","last_synced_at":"2026-01-17T07:26:47.475Z","repository":{"id":213713831,"uuid":"93274293","full_name":"noti0na1/Racket-Codes","owner":"noti0na1","description":"A Collection of My Racket Code","archived":false,"fork":false,"pushed_at":"2017-09-18T06:52:49.000Z","size":15,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T10:36:15.250Z","etag":null,"topics":["cps","data-structures","macros","racket"],"latest_commit_sha":null,"homepage":null,"language":"Racket","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/noti0na1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-06-03T21:15:23.000Z","updated_at":"2024-03-25T22:59:28.000Z","dependencies_parsed_at":"2023-12-22T16:10:35.381Z","dependency_job_id":"494d65cc-0e8c-4db6-9a7f-d3b661d4378a","html_url":"https://github.com/noti0na1/Racket-Codes","commit_stats":null,"previous_names":["noti0na1/racket-codes"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/noti0na1/Racket-Codes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noti0na1%2FRacket-Codes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noti0na1%2FRacket-Codes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noti0na1%2FRacket-Codes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noti0na1%2FRacket-Codes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noti0na1","download_url":"https://codeload.github.com/noti0na1/Racket-Codes/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noti0na1%2FRacket-Codes/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28504074,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T06:57:29.758Z","status":"ssl_error","status_checked_at":"2026-01-17T06:56:03.931Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cps","data-structures","macros","racket"],"created_at":"2024-10-28T21:23:45.834Z","updated_at":"2026-01-17T07:26:42.467Z","avatar_url":"https://github.com/noti0na1.png","language":"Racket","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Racket-Codes\n\nA Collection of My Racket Code\n\n## Control\n\n### fixpoint.rkt\n\nY-combinator in racket\n\n```racket\n#lang racket\n\n(define rec\n  (λ (f) ((λ (x) (λ a (apply (f (x x)) a)))\n          (λ (x) (λ a (apply (f (x x)) a))))))\n\n(define fun\n  (rec (λ (fun)\n         (λ (x)\n           (if (= x 0) 1 (* x (fun (- x 1))))))))\n\n(fun 10)\n```\n\n### flow.rkt\n\nPut function calls in a streaming fashion\n\n```racket\n(\u003e\u003e 3 (λ (x) (+ x 2)) (λ (x) (+ x 3)))\n\n(define (fun0 x y)\n  (values (+ x y) (- x y)))\n\n(define p0 (-\u003e fun0 (-\u003e fun0) fun0))\n\n((-\u003e (inject 2 3) p0))\n```\n\n### goto.rkt\n\nAdd goto/label into Racket\n\n```racket\n(prog\n (displayln 1)\n (goto lb0)\n (displayln 5)\n (label lb1)\n (displayln 3)\n (goto end)\n (label lb0)\n (displayln 2)\n (goto lb1)\n (label end))\n```\n\n### trampoline.rkt\n\nA simple implement of trampoline\n\n```\n(define (my-even? n)\n  (if (zero? n)\n      #t\n      (bounce my-odd? (sub1 (abs n)))))\n\n(define (my-odd? n)\n  (if (zero? n)\n      #f\n      (bounce my-even? (sub1 (abs n)))))\n\n(trampoline my-even? 99999)\n```\n\n### while-loop.rkt\n\nImplement while loop using macro and cc, support continue and break\n\n```racket\n(let ([a 1])\n  (while (\u003c a 10)\n         (set! a (+ a 1))\n         (let ([b 1])\n           (while (\u003c b a)\n                (display b)\n                (display \" \")\n                (set! b (+ b 1))\n                (when (= b 5) (break)))\n         (display a)\n         (display \" \"))))\n```\n\n## Data Structure\n\n### braun-tree.rkt\n\nImplement of Braun Tree\n\n### BTrees.rkt\n\nImplement traversing Binary Tree in different styles (CPS)\n\n### PBLT.rkt\n\n//PBLT\n\n### stream.rkt\n\nA simple implement of stream\n\n```racket\n(define (fun x)\n  (display \"x=\")\n  (displayln x)\n  (* x 2))\n\n(define s1 (stream-extend (fun 1) (stream-extend (fun 2) (stream-extend (fun 3) empty-stream))))\n\n(define s2 (stream-append s1 s1))\n\n(print-stream s2)\n\n(define (infinite-build n)\n  (stream-extend n (infinite-build (+ n 1))))\n\n(define infinite (infinite-build 1))\n\n(print-stream (stream-take 10 infinite))\n\n(define (sixtyDiv n)\n  (stream-extend (/ 60 n) (sixtyDiv (- n 1))))\n\n(define s4 (stream-take 4 (sixtyDiv 4)))\n(print-stream s4)\n\n#|\n(stream-first s4)\n(set! s4 (stream-rest s4))\n(stream-first s4)\n(set! s4 (stream-rest s4))\n(stream-first s4)\n(set! s4 (stream-rest s4))\n(stream-first s4)\n(set! s4 (stream-rest s4))\n|#\n```\n\n## Others\n\n### self-reproducing\n\n```\n#lang racket\n\n;; \"Ω\"\n\n((λ (x) `(,x ',x)) '(λ (x) `(,x ',x)))\n\n;; call/cc\n\n(call/cc\n (lambda (c)\n   (c ((lambda (c) `(call/cc (lambda (c) (c (,c ',c)))))\n       '(lambda (c) `(call/cc (lambda (c) (c (,c ',c)))))))))\n\n;; print\n\n(let ([a \"#lang racket\\n\\n(let ([a ~s]))\\n  (printf a a))\"])\n  (printf a a))\n```\n\n### function-keyword.rkt\n\nUsing keywords in function definition\n\n```racket\n(fun #:mode 3 2 3)\n```\n\n### list-comprehension.rkt\n\nImplement list comprehension\n\n```racket\n;; [x * y | x \u003c- [-1, 2, -4, 4], x \u003e 0, y \u003c- [10, 20, 30], x * y \u003c 50]\n(listc (* x y) for (x \u003c- (list -1 2 -3 4)) (\u003e x 0) (y \u003c- (list 10 20 30)) (\u003c (* x y) 50))\n\n;; [[x, y, z] | x \u003c- [1, 2, 3], y \u003c- [4, 5], z \u003c- [6]]\n(listc (list x y z) for (x \u003c- (list 1 2 3)) (y \u003c- (list 4 5)) (z \u003c- (list 6)))\n```\n\n### parmeterize.rkt\n\nUse of parameterize\n\n### trace.rkt\n\nTrace function calls (from internet)\n\n### sweet.rkt\n\nSimple example of sweet-expression\n\n```racket\n#lang sweet-exp racket\n\ndefine add(x y)\n    {x + y}\n\ndefine mult(x y)\n    {x * y}\n\ndefine fun(x y)\n    if {x \u003c y}\n       add(x y)\n       mult(x y)\n\nfun(2 3)\nfun(3 2)\n```\n\n### comments.rkt\n\nexamples of different types of comments\n\n```racket\n#lang racket\n\n;   single\n;;  line\n;;; coments\n\n#| block\n   comments\n|#\n\n#;(define (fun x)\n    (s-exp comments))\n\n#! /bin/sh\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoti0na1%2Fracket-codes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoti0na1%2Fracket-codes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoti0na1%2Fracket-codes/lists"}