commit 40756e4b5c8e5c32fcfffcad6af99b47c12925bf
parent 3d6cbd0df238759360eaaea926bee5c8e28896c5
Author: Ed van Bruggen <edvb@uw.edu>
Date: Thu, 17 Sep 2020 18:11:04 -0700
Rename define primitive to def
Diffstat:
9 files changed, 167 insertions(+), 167 deletions(-)
diff --git a/doc/tisp.1 b/doc/tisp.1
@@ -1,4 +1,4 @@
-.TH TISP 1 "January 2020" "0.0.0"
+.TH TISP 1 "September 2020" "tisp 0.0.0"
.PP
.SH NAME
tisp \- tiny lisp
@@ -116,7 +116,7 @@ Lambda functions created within Tisp itself. Called using list syntax where the
.PP
.TP
\fBPrimitives\fP
-Procedures built in to the language written in C. Called like regular functions, see primitives section for more details. \fBeg\fP 'car', 'cond', 'define', 'write', '+'
+Procedures built in to the language written in C. Called like regular functions, see primitives section for more details. \fBeg\fP 'car', 'cond', 'def', 'write', '+'
.PP
.TP
\fBMacros\fP
@@ -159,7 +159,7 @@ Tests if multiple values are all equal. Returns 'nil' if any are not, and 't' ot
Evaluates each expression if the given condition corresponding to it is true. Runs through all arguments, each is a list with the first element as the condition which needs to be 't' after evaluated, and the rest of the list is the body to be run if and only if the condition is met. Used for if/elseif/else statements found in C-like languages and 'if','when','unless','switch' macros in Tisp.
.PP
.TP
-\fBtype\fP
+\fBtypeof\fP
Returns a string stating the given argument's type. Used to create 'type?' individual functions.
.PP
.TP
@@ -171,8 +171,8 @@ Creates function, first argument is a list of elements representing the symbol n
Similar to lambda, creates anonymous macro with first argument as macro's argument list and rest as macro's body.
.PP
.TP
-\fBdefine\fP
-Create variable with the name of the first argument, with the value of the second. If name given is a list use the first element of this list as a new functions name and rest of list as its arguments.
+\fBdef\fP
+Create variable with the name of the first argument, with the value of the second. If name given is a list use the first element of this list as a new functions name and rest of list as its arguments. If only variable name is given make it self evaluating.
.PP
.TP
\fBset!\fP
diff --git a/doc/tisp.1.md b/doc/tisp.1.md
@@ -144,7 +144,7 @@ element of the argument given, in this case a list of size 3, which returns
Procedures built in to the language written in C. Called like regular
functions, see primitives section for more details. **eg** `car`, `cond`,
-`define`, `write`, `+`
+`def`, `write`, `+`
#### Macros
@@ -217,7 +217,7 @@ be run with the supplied arguments.
Similar to lambda, creates anonymous macro with first argument as macro's
argument list and rest as macro's body.
-#### define
+#### def
Create variable with the name of the first argument, with the value of the
second. If name given is a list use the first element of this list as a new
diff --git a/test.c b/test.c
@@ -115,7 +115,7 @@ char *tests[][2] = {
{ "(eval (+ 1 2))", "3" },
{ "(eval '(- 4 3))", "1" },
{ "(eval ''(mod 9 3))", "(mod 9 3)" },
- { "(do (define bar '(/ 25 5)) (eval bar))", "5" },
+ { "(do (def bar '(/ 25 5)) (eval bar))", "5" },
{ "cond", NULL },
{ "(cond)", "#<void>" },
@@ -179,24 +179,24 @@ char *tests[][2] = {
{ "(= '((1 2) 3 4) '((1 2) 3 4))", "t" },
{ "(= '((1 b) 3 4) '((1 2) 3 4))", "nil" },
- { "define", NULL },
- { "(define foo 4)", "#<void>" },
+ { "def", NULL },
+ { "(def foo 4)", "#<void>" },
{ "foo", "4" },
- { "(define bar foo)", "#<void>" },
+ { "(def bar foo)", "#<void>" },
{ "bar", "4" },
{ "(set! foo 5)", "5" },
{ "foo", "5" },
{ "(set! foo (+ foo bar))", "9" },
{ "foo", "9" },
- { "(define add +)", "#<void>" },
+ { "(def add +)", "#<void>" },
{ "(add foo bar)", "13" },
- { "(define (one x) (add x 1))", "#<void>" },
+ { "(def (one x) (add x 1))", "#<void>" },
{ "(one foo)", "10" },
- { "(define (more x)"
- " (define term 3)"
+ { "(def (more x)"
+ " (def term 3)"
" (+ x term))", "#<void>" },
{ "(more 8)", "11" },
- { "(define (add2 x)"
+ { "(def (add2 x)"
" (+ x 1) (+ x 2))", "#<void>" },
{ "(add2 2)", "4" },
{ "(set! add2 2)", "2" },
@@ -367,7 +367,7 @@ char *tests[][2] = {
{ "(swap (list 1/2 1/4 1/9 1/16))", "(1/4 1/2 1/9 1/16)" },
{ "stack!", NULL },
- { "(define s '(1 2 3 4 5))", "#<void>" },
+ { "(def s '(1 2 3 4 5))", "#<void>" },
{ "(peek s)", "1" },
{ "(pop! s)", "1" },
{ "s", "(2 3 4 5)" },
diff --git a/tib/core.tsp b/tib/core.tsp
@@ -1,66 +1,66 @@
-(define (list . lst) lst)
+(def (list . lst) lst)
-(define defmacro
+(def defmacro
(macro (args . body)
- (list 'define (car args) (list 'macro (cdr args) . body))))
+ (list 'def (car args) (list 'macro (cdr args) . body))))
;;; CXR
-(define (caar x) (car (car x)))
-(define (cadr x) (car (cdr x)))
-(define (cdar x) (cdr (car x)))
-(define (cddr x) (cdr (cdr x)))
-(define (caaar x) (car (car (car x))))
-(define (caadr x) (car (car (cdr x))))
-(define (cadar x) (car (cdr (car x))))
-(define (caddr x) (car (cdr (cdr x))))
-(define (cdaar x) (cdr (car (car x))))
-(define (cdadr x) (cdr (car (cdr x))))
-(define (cddar x) (cdr (cdr (car x))))
-(define (cdddr x) (cdr (cdr (cdr x))))
-(define (caaaar x) (car (car (car (car x)))))
-(define (caaadr x) (car (car (car (cdr x)))))
-(define (caadar x) (car (car (cdr (car x)))))
-(define (caaddr x) (car (car (cdr (cdr x)))))
-(define (cadaar x) (car (cdr (car (car x)))))
-(define (cadadr x) (car (cdr (car (cdr x)))))
-(define (caddar x) (car (cdr (cdr (car x)))))
-(define (cadddr x) (car (cdr (cdr (cdr x)))))
-(define (cdaaar x) (cdr (car (car (car x)))))
-(define (cdaadr x) (cdr (car (car (cdr x)))))
-(define (cdadar x) (cdr (car (cdr (car x)))))
-(define (cdaddr x) (cdr (car (cdr (cdr x)))))
-(define (cddaar x) (cdr (cdr (car (car x)))))
-(define (cddadr x) (cdr (cdr (car (cdr x)))))
-(define (cdddar x) (cdr (cdr (cdr (car x)))))
-(define (cddddr x) (cdr (cdr (cdr (cdr x)))))
+(def (caar x) (car (car x)))
+(def (cadr x) (car (cdr x)))
+(def (cdar x) (cdr (car x)))
+(def (cddr x) (cdr (cdr x)))
+(def (caaar x) (car (car (car x))))
+(def (caadr x) (car (car (cdr x))))
+(def (cadar x) (car (cdr (car x))))
+(def (caddr x) (car (cdr (cdr x))))
+(def (cdaar x) (cdr (car (car x))))
+(def (cdadr x) (cdr (car (cdr x))))
+(def (cddar x) (cdr (cdr (car x))))
+(def (cdddr x) (cdr (cdr (cdr x))))
+(def (caaaar x) (car (car (car (car x)))))
+(def (caaadr x) (car (car (car (cdr x)))))
+(def (caadar x) (car (car (cdr (car x)))))
+(def (caaddr x) (car (car (cdr (cdr x)))))
+(def (cadaar x) (car (cdr (car (car x)))))
+(def (cadadr x) (car (cdr (car (cdr x)))))
+(def (caddar x) (car (cdr (cdr (car x)))))
+(def (cadddr x) (car (cdr (cdr (cdr x)))))
+(def (cdaaar x) (cdr (car (car (car x)))))
+(def (cdaadr x) (cdr (car (car (cdr x)))))
+(def (cdadar x) (cdr (car (cdr (car x)))))
+(def (cdaddr x) (cdr (car (cdr (cdr x)))))
+(def (cddaar x) (cdr (cdr (car (car x)))))
+(def (cddadr x) (cdr (cdr (car (cdr x)))))
+(def (cdddar x) (cdr (cdr (cdr (car x)))))
+(def (cddddr x) (cdr (cdr (cdr (cdr x)))))
;;; Types
-(define (any? x) t)
-(define (void? x) (= (typeof x) "void"))
-(define (nil? x) (= (typeof x) "nil"))
-(define empty? nil?)
-(define (integer? x) (= (typeof x) "integer"))
-(define (decimal? x) (= (typeof x) "decimal"))
-(define (ratio? x) (= (typeof x) "ratio"))
-(define (string? x) (= (typeof x) "string"))
-(define (symbol? x) (= (typeof x) "symbol"))
-(define (primitive? x) (= (typeof x) "primitive"))
-(define (function? x) (= (typeof x) "function"))
-(define (macro? x) (= (typeof x) "macro"))
-(define (pair? x) (= (typeof x) "pair"))
-(define (atom? x) (not (pair? x)))
-(define (cons? x) (and (pair? x) (not (pair? (cdr x)))))
-(define (list? x) (if (pair? x) (list? (cdr x)) (not x)))
-(define (boolean? x) (or (= x t) (nil? x)))
-(define (true? x) (= x t))
-(define false? nil?)
-(define (procedure? x) (or (primitive? x) (or (function? x) (macro? x))))
-(define (rational? x) (or (integer? x) (ratio? x)))
-(define (number? x) (or (rational? x) (decimal? x)))
-
-(define (bool x) (if x t nil))
+(def (any? x) t)
+(def (void? x) (= (typeof x) "void"))
+(def (nil? x) (= (typeof x) "nil"))
+(def empty? nil?)
+(def (integer? x) (= (typeof x) "integer"))
+(def (decimal? x) (= (typeof x) "decimal"))
+(def (ratio? x) (= (typeof x) "ratio"))
+(def (string? x) (= (typeof x) "string"))
+(def (symbol? x) (= (typeof x) "symbol"))
+(def (primitive? x) (= (typeof x) "primitive"))
+(def (function? x) (= (typeof x) "function"))
+(def (macro? x) (= (typeof x) "macro"))
+(def (pair? x) (= (typeof x) "pair"))
+(def (atom? x) (not (pair? x)))
+(def (cons? x) (and (pair? x) (not (pair? (cdr x)))))
+(def (list? x) (if (pair? x) (list? (cdr x)) (not x)))
+(def (boolean? x) (or (= x t) (nil? x)))
+(def (true? x) (= x t))
+(def false? nil?)
+(def (procedure? x) (or (primitive? x) (or (function? x) (macro? x))))
+(def (rational? x) (or (integer? x) (ratio? x)))
+(def (number? x) (or (rational? x) (decimal? x)))
+
+(def (bool x) (if x t nil))
; TODO handle string and sym
-(define (pair x)
+(def (pair x)
(cond
((rational? x)
(cons (numerator x)
@@ -76,7 +76,7 @@
(error 'assert "assertion " ',expr " failed")))
; TODO support any sized list n depending on size of optional val
-(define (default n val)
+(def (default n val)
(cond
((nil? n) val)
((and (pair? n) (nil? (cdr n)))
@@ -87,7 +87,7 @@
; TODO if b = pair and car b = else use cdr b
(defmacro (if con a b)
(list 'cond (list con a) (list t b)))
-(define else t)
+(def else t)
(defmacro (when con . body)
(list 'cond (list con (cons 'do body))))
(defmacro (unless con . body)
@@ -98,7 +98,7 @@
(append
(map
(lambda (x)
- (list* 'define (car x) (cdr x)))
+ (list* 'def (car x) (cdr x)))
vars)
body))))
@@ -117,10 +117,10 @@
; TODO allow for improper lists
(defmacro (quasiquote x)
- (define (check x)
+ (def (check x)
(unless (and (pair? (cdr x)) (nil? (cddr x)))
(error (car x) "invalid form " x)))
- (define (quasicons a d)
+ (def (quasicons a d)
(if (pair? d)
(if (= (car d) 'quote)
(if (and (pair? a) (= (car a) 'quote))
@@ -143,9 +143,9 @@
(defmacro (unquote x) (list error ''unquote "called outside of quasiquote"))
;;; Logic
-(define true t)
-(define false ())
-(define (not x)
+(def true t)
+(def false ())
+(def (not x)
(if x nil t))
; TODO logic func many arguments
; Use a macro so arguments aren't evaluated all at once
@@ -159,28 +159,28 @@
(list 'not (list 'or a b)))
;;; Lists
-(define (list* . lst)
+(def (list* . lst)
(if (cdr lst)
(cons (car lst) (apply list* (cdr lst)))
(car lst)))
-(define (do . body) (last body))
-(define (do0 . body) (car body))
+(def (do . body) (last body))
+(def (do0 . body) (car body))
-(define (length lst)
+(def (length lst)
(recur f ((lst lst) (x 0))
(if lst
(f (cdr lst) (+ x 1))
x)))
-(define (last lst)
+(def (last lst)
; recur loop ((lst lst) (n (if n (car n) 0)))
(if (cdr lst)
(last (cdr lst))
(car lst)))
; TODO make nth generic for list str vec, made up of list-ref vec-ref str-ref
-(define (nth lst n)
+(def (nth lst n)
(cond
((atom? lst)
(error 'nth "index of list out of bounds"))
@@ -189,46 +189,46 @@
; TODO diff name head/tail since conflicts w/ unix
; TODO support negative numers like unix tail/head to count from end backwards
-(define (head lst n)
+(def (head lst n)
(cond
((<= n 0) nil)
((atom? lst)
(error 'name "index of list out of bounds"))
(else (cons (car lst) (head (cdr lst) (- n 1))))))
-(define (tail lst n)
+(def (tail lst n)
(cond
((<= n 0) lst)
((atom? lst)
(error 'tail "index of list out of bounds"))
(else (tail (cdr lst) (- n 1)))))
-(define (count x lst)
+(def (count x lst)
(cond ((nil? lst) 0)
((atom? lst) (error 'count "expected proper list"))
((= x (car lst)) (+ 1 (count x (cdr lst))))
(else (count x (cdr lst)))))
; TODO many args
-(define (apply proc args)
+(def (apply proc args)
(eval (map (lambda (x) ; prevent args from being evaluated twice
(list 'quote x))
(cons proc args))))
; TODO many lsts for proc w/ multi arguments
-(define (map proc lst)
+(def (map proc lst)
(if lst
(cons (proc (car lst))
(map proc (cdr lst)))
nil))
-(define (filter proc lst)
+(def (filter proc lst)
(cond
((not (pair? lst)) nil)
((proc (car lst)) (cons (car lst) (filter proc (cdr lst))))
(else (filter proc (cdr lst)))))
-(define (compose . procs)
+(def (compose . procs)
(cond
((nil? procs) (lambda x x))
((nil? (cdr procs)) (car procs))
@@ -236,20 +236,20 @@
(lambda x
((car procs) (apply (apply compose (cdr procs)) x))))))
-(define (reverse l)
+(def (reverse l)
(recur f ((in l) (out nil))
(if (pair? in)
(f (cdr in) (cons (car in) out))
out)))
; TODO accept many lists to append
-(define (append x y)
+(def (append x y)
(cond
((pair? x) (cons (car x) (append (cdr x) y)))
((nil? x) y)
(else (error 'append "expected proper list"))))
-(define (zip x y)
+(def (zip x y)
(cond ((and (nil? x) (nil? y)) nil)
((or (nil? x) (nil? y)) (error 'zip "given lists of unequal length"))
((and (pair? x) (pair? y))
@@ -257,47 +257,47 @@
(zip (cdr x) (cdr y))))))
; TODO assoc optional equal? arg
-(define (assoc key table)
+(def (assoc key table)
(cond ((nil? table) nil)
((= key (caar table)) (car table))
(else (assoc key (cdr table)))))
-(define (memp proc lst)
+(def (memp proc lst)
(cond ((nil? lst) nil)
((proc (car lst)) lst)
(else (memp proc (cdr lst)))))
-(define (member mem lst)
+(def (member mem lst)
(memp (lambda (x) (= mem x)) lst))
-; define English list element accessors
-(define rest cdr) ; TODO first and rest are generics for list, vec, str types
-(define first car)
-(let (((def name count)
- (list 'define (list name 'x) (list 'nth 'x count))))
+; def English list element accessors
+(def rest cdr) ; TODO first and rest are generics for list, vec, str types
+(def first car)
+(let (((defi name count)
+ (list 'def (list name 'x) (list 'nth 'x count))))
(recur f ((n 1)
(lst '(second third forth fifth sixth seventh eighth ninth tenth)))
(when lst
- (eval (def (car lst) n))
+ (eval (defi (car lst) n))
(f (+ n 1) (cdr lst)))))
;;; Stacks
-(define (push stack val)
+(def (push stack val)
(cons val stack))
(defmacro (push! stack val)
`(set! ,stack (push ,stack ,val)))
-(define pop cdr)
+(def pop cdr)
(defmacro (pop! stack)
`(do0
(peek ,stack)
(set! ,stack (pop ,stack))))
-(define peek car)
+(def peek car)
-(define (swap stack)
+(def (swap stack)
(let ((x (peek stack))
(y (peek (pop stack))))
(push (push (pop (pop stack)) x) y)))
diff --git a/tib/doc.tsp b/tib/doc.tsp
@@ -1,4 +1,4 @@
-(define docstr-reg
+(def docstr-reg
'((car
"(car lst)"
"return first element of list")
@@ -35,9 +35,9 @@
(macro
"(macro args . body)"
"create anonymous macro")
- (define
- "(define var . val)"
- "(define (func . args) . body)"
+ (def
+ "(def var . val)"
+ "(def (func . args) . body)"
"creates new variable with value, or create new function if argument list given"
"if value for variable is not given, make it a self-evaluating symbol")
(set!
@@ -53,11 +53,11 @@
"(version)"
"return string of tisp's version number")))
-(define (doc proc)
+(def (doc proc)
"get documentation of function supplied by its doc string"
(unless (procedure? proc)
(error 'doc "documentation only exists for procedures"))
- (define (lookup proc)
+ (def (lookup proc)
(recur f ((docstr docstr-reg))
(cond ((nil? docstr)
(error 'doc (get proc 'name) ": no documentation found"))
diff --git a/tib/io.tsp b/tib/io.tsp
@@ -1,11 +1,11 @@
-(define (run file) (eval (parse (read file))))
-(define (print . str) (apply write (list* 'stdout nil str)))
-(define (newline . file)
+(def (run file) (eval (parse (read file))))
+(def (print . str) (apply write (list* 'stdout nil str)))
+(def (newline . file)
(if (or (nil? file) (nil? (cdr file)))
(write (car (or file '(stdout))) file "\n")
(error 'newline "only zero or one file can be given")))
-(define (display . str)
+(def (display . str)
(map (lambda (s)
(cond
((string? s) (print "\"" s "\""))
@@ -14,5 +14,5 @@
((pair? s) (print "'" s))
(else (print s))))
str))
-(define (displayln . str) (apply display str) (newline))
-(define (println . str) (apply print str) (newline))
+(def (displayln . str) (apply display str) (newline))
+(def (println . str) (apply print str) (newline))
diff --git a/tib/math.tsp b/tib/math.tsp
@@ -1,19 +1,19 @@
;;; Constants
-(define pi (* 4 (arctan 1.)))
-(define tau (* 2 pi))
-(define e (exp 1.))
+(def pi (* 4 (arctan 1.)))
+(def tau (* 2 pi))
+(def e (exp 1.))
;;; Functions
-(define (inc x) (+ x 1))
-(define (dec x) (- x 1))
-(define (truncate x) (* (floor (abs x)) (sgn x)))
-(define (sqr x) (* x x))
-(define (cube x) (* x (* x x)))
-(define (root b p) (^ b (/ p)))
-(define (sqrt x) (root x 2))
-(define (cbrt x) (root x 3))
-(define (logb b x) (/ (log x) (log b)))
-(define (log10 x) (logb 10. x))
+(def (inc x) (+ x 1))
+(def (dec x) (- x 1))
+(def (truncate x) (* (floor (abs x)) (sgn x)))
+(def (sqr x) (* x x))
+(def (cube x) (* x (* x x)))
+(def (root b p) (^ b (/ p)))
+(def (sqrt x) (root x 2))
+(def (cbrt x) (root x 3))
+(def (logb b x) (/ (log x) (log b)))
+(def (log10 x) (logb 10. x))
(defmacro (++ x . n)
`(set! ,x (+ ,x ,(default n 1))))
@@ -21,39 +21,39 @@
`(set! ,x (- ,x ,(default n 1))))
; inverse trig functions
-(define (csc x) (/ (sin x)))
-(define (arccsc x) (/ (arcsin x)))
-(define (csch x) (/ (sinh x)))
-(define (arccsch x) (/ (arcsinh x)))
-(define (sec x) (/ (cos x)))
-(define (arcsec x) (/ (arccos x)))
-(define (sech x) (/ (cosh x)))
-(define (arcsech x) (/ (arccosh x)))
-(define (cot x) (/ (tan x)))
-(define (arccot x) (/ (arctan x)))
-(define (coth x) (/ (tanh x)))
-(define (arccoth x) (/ (arctanh x)))
-
-(define (abs x) (if (>= x 0) x (- x)))
-(define (sgn x) (if (= x 0) x (/ (abs x) x)))
+(def (csc x) (/ (sin x)))
+(def (arccsc x) (/ (arcsin x)))
+(def (csch x) (/ (sinh x)))
+(def (arccsch x) (/ (arcsinh x)))
+(def (sec x) (/ (cos x)))
+(def (arcsec x) (/ (arccos x)))
+(def (sech x) (/ (cosh x)))
+(def (arcsech x) (/ (arccosh x)))
+(def (cot x) (/ (tan x)))
+(def (arccot x) (/ (arctan x)))
+(def (coth x) (/ (tanh x)))
+(def (arccoth x) (/ (arctanh x)))
+
+(def (abs x) (if (>= x 0) x (- x)))
+(def (sgn x) (if (= x 0) x (/ (abs x) x)))
; TODO many args
-(define (max a b) (if (> a b) a b))
-(define (min a b) (if (< a b) a b))
+(def (max a b) (if (> a b) a b))
+(def (min a b) (if (< a b) a b))
-(define (positive? x) (> x 0))
-(define (negative? x) (< x 0))
-(define (zero? x) (= x 0))
-(define (even? x) (= (mod x 2) 0))
-(define (odd? x) (= (mod x 2) 1))
+(def (positive? x) (> x 0))
+(def (negative? x) (< x 0))
+(def (zero? x) (= x 0))
+(def (even? x) (= (mod x 2) 0))
+(def (odd? x) (= (mod x 2) 1))
-(define (dot v w)
+(def (dot v w)
(if v
(+ (* (car v) (car w))
(dot (cdr v) (cdr w)))
0))
-(define (norm v) (sqrt (dot v v)))
+(def (norm v) (sqrt (dot v v)))
-(define (! n)
+(def (! n)
(if (= n 1)
1
(* n (! (- n 1)))))
diff --git a/tib/repl.tsp b/tib/repl.tsp
@@ -1,4 +1,4 @@
-(define (repl)
+(def (repl)
(print "> ")
(let ((expr (parse (read))))
(unless (and (pair? expr) (= (car expr) 'quit))
@@ -9,7 +9,7 @@
(repl)))))
;; simple repl, only requires io.c tib
-(define (repl-simple)
+(def (repl-simple)
(write 'stdout nil "> ")
(write 'stdout nil (eval (parse (read))) "\n")
(repl-simple))
diff --git a/tisp.c b/tisp.c
@@ -987,21 +987,21 @@ prim_macro(Tsp st, Hash env, Val args)
* function name and the cdr the function arguments */
/* TODO if var not func error if more than 2 args */
static Val
-prim_define(Tsp st, Hash env, Val args)
+prim_def(Tsp st, Hash env, Val args)
{
Val sym, val;
- tsp_arg_min(args, "define", 1);
+ tsp_arg_min(args, "def", 1);
if (car(args)->t == PAIR) { /* create function if given argument list */
sym = caar(args); /* first element of argument list is function name */
if (sym->t != SYMBOL)
- tsp_warnf("define: incorrect format,"
+ tsp_warnf("def: incorrect format,"
" expected symbol for function name, received %s",
type_str(sym->t));
val = mk_func(FUNCTION, sym->v.s, cdar(args), cdr(args), env);
} else if (car(args)->t == SYMBOL) { /* create variable */
sym = car(args); /* if only symbol given, make it self evaluating */
val = nilp(cdr(args)) ? sym : tisp_eval(st, env, cadr(args));
- } else tsp_warn("define: incorrect format, no variable name found");
+ } else tsp_warn("def: incorrect format, no variable name found");
if (!val)
return NULL;
/* set procedure name if it was previously anonymous */
@@ -1162,7 +1162,7 @@ tisp_env_init(size_t cap)
tsp_env_fn(get);
tsp_env_fn(lambda);
tsp_env_fn(macro);
- tsp_env_fn(define);
+ tsp_env_fn(def);
tsp_env_name_fn(set!, set);
tsp_env_fn(load);
tsp_env_fn(error);