Irken

1 program Added 2026-02-27T10:00:00Z Agent: claude-codeModel: claude-sonnet-4-6WebSearch: disabled Evidence Report issue View issues
Aliases: —
Provenance: commit a665507465 · authored 2026-02-27T12:29:09+01:00 · agent claude-code · model claude-sonnet-4-6

Sources mentioning this language

1 source · not in taxonomy (canonical name didn't match any upstream)
LLM (this repo) · 1

Related languages

Aiken (0.27)GEDANKEN (0.21)Eden (0.18)Gren (0.18)When (0.18)

LLM-contributed programs

Datatype Declarations and List Operations

Provenance: commit a665507465 · authored 2026-02-27T12:29:09+01:00 · agent claude-code · model claude-sonnet-4-6 · WebSearch disabled
code.scm · added: 2026-02-27T10:00:00Z
;; re-introducing datatype declarations for normal sum types

(datatype list
  (:nil)
  (:cons 'a (list 'a))
  )

(datatype bool (:true) (:false))

(define (+ a b)
  (%%cexp (int int -> int) "%0+%1" a b))

(define (- a b)
  (%%cexp (int int -> int) "%0-%1" a b))

(define (zero? a)
  (%%cexp (int -> bool) "%0==0" a))

(define (length l)
  (let loop ((l l) (r 0))
    (vcase list l
       ((:nil) r)
       ((:cons _ tl) (loop tl (+ r 1))))))

(define (range n)
  (let loop ((n n) (r (list:nil)))
    (if (zero? n)
	r
	(loop (- n 1) (list:cons n r)))))

(define (n-of n x)
  (let loop ((n n) (r (list:nil)))
    (if (zero? n)
	r
	(loop (- n 1) (list:cons x r)))))

(define (member x = l)
  (let loop ((l l))
    (vcase list l
       ((:nil) #f)
       ((:cons hd tl)
	(if (= x hd)
	    #t
	    (loop tl))))))

(define (printn x)
  (%%cexp ('a -> undefined) "dump_object (%0, 0); fprintf (stdout, \"\n\")" x))

(define (= a b)
  (%%cexp (int int -> bool) "%0==%1" a b))

(let ((l0 (range 5))
      (l1 (list:nil))
      (l2 (list:nil))
      )
  (printn l0)
  (printn (length l0))
  (printn l1)
  (printn (length l1))
  (set! l1 (list:cons #\C l1))
  (printn l1)
  (printn (length l1))
  (set! l1 (list:cons #\B l1))
  (printn l1)
  (printn (length l1))
  (set! l1 (list:cons #\A l1))
  (printn l1)
  (printn (length l1))
  (set! l2 (n-of 10 "hello"))
  (printn l2)
  (printn (member 15 = l0))
  (printn (member 3  = l0))
  99
  )

Contribute — propose a file extension

Tell us where to find evidence about Irken (mapped to pl/irken). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/Irken/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← Iris Irma →