46 lines · 2.7 KB · Markdown
RawDownload

Syntax differences

StreetLISP Scheme
(help topic) (help topic) (in Racket)
(def (f x y) ...) (define (f x y) ...)
(defmacro (f x y) ...) (define-syntax f ...)
(defstruct ...)¹ (define-record-type ...)
(if cond if-true if-else) (if cond if-true if-else)
(when cond expr) (if cond expr)
(unless cond expr) (if (not cond) expr)
NIL, () null, '()
NIL, T (case-sensitive) #f, #t
(not x) (null? x)
(car ()) → NIL (car '()) → ERROR
(cdr ()) → NIL (cdr '()) → ERROR
(cons? v) (pair? v)
(str ...) (string ...)
(str sym) (symbol->string sym)
(sym str) (string->symbol str)
(num->str n :base r) (number->string n r)
(str->num str :base r) (string->number str r)
(subseq str start end) (substring str start end)
(length str) (string-length str)
(str-rune str i) (string-ref str i)
(map rune-upcase str) (string-upcase str)
(rune-whitespace? r) (char-whitespace? r)
(rune-upcase r) (char-upcase r)
(rune codepoint) (integer->char codepoint)
(rune->codepoint r) (char->integer r)
(bool? v) (boolean? v)
(int? v) (integer? v)
(num? v) (number? v)
(rune? v) (char? v)
(str? v) (string? v)
(sym? v) (symbol? v)
(vec? v) (vector? v)
(equal? a b) (string=? a b)
(vec->list v) (vector->list v)
(list->vec lst) (list->vector lst)
(length v) (vector-length v)
(aref v i) (vector-ref v i)
(aset! v i x) (vector-set! v i x)
(path-delete path) (delete-file path)

¹ defstruct macro, Common Lisp

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t