Skip to content

Instantly share code, notes, and snippets.

Glorp / input.txt
Last active Aug 16, 2021
term frequency
View input.txt
White tigers live mostly in India
Wild lions live mostly in Africa
View order.rkt
#lang lazy
; put racket instead of lazy in the line above to make it less lazy
(struct zero () #:transparent)
(struct succ (pred) #:transparent)
(define one (succ (zero)))
(define two (succ one))
(define (inf) (succ (inf)))
View caesar.jsh
// to run: jshell caesar.jsh
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public class Caechar {
public static Caechar fromAlphabet(String str) {
View caesar.rkt
#lang racket
(define alphabet (list->vector (string->list "abcdefghijklmnopqrstuvwxyzæøå ")))
(define (caeschar shift char)
(match char
[#\newline #\newline]
[#\return #\return]
[c (match (vector-member c alphabet)
[#f #f]
View test.fsx
type KuEgenskaper =
{ navn : string
hoyde : int
type Animal =
| Coo of KuEgenskaper
| Hest of int
| Bamse
View trees.js
// sums, constructing
const tag = t => {
function halp() {
return { tag: t, values: [... arguments] }
return halp;
// testing
tag("label")(1, "horse", [2,3]);
View trees.sml
datatype fruit =
| Apple
| Pear
| Lemon
| Fig
datatype tree =
| Flat of fruit * tree
View jump.asm
!cpu 6502
!to "jump.prg",cbm
* = $0801
!byte $0d,$08,$dc,$07,$9e,$20,$34,$39
!byte $31,$35,$32,$00,$00,$00
* = $c000
ldx foo_addr
View baklengs.rkt
#lang racket
(provide (rename-out [my-read read]
[my-read-syntax read-syntax]))
(define (my-read in) (syntax->datum (my-read-syntax #f in)))
(define (rev stx)
(define l (syntax->list stx))
(if l
(datum->syntax stx (reverse (map rev l)) stx stx)
Glorp / 42.rkt
Last active Mar 26, 2017
Solving a number problem using idiomatic LISP
View 42.rkt
#lang racket
(define (read-string s)
([(λ (_) #t) (λ (_) 0)])
(define in (open-input-string s))
(let loop ()
(unless (eof-object? (read in))