This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

(load filename) vs sbcl filename?

2 posts · 4553 views

Here's a simple code I wrote while learning loop, foo.lisp:
(defun foo-bar (m)
	(setq aa 1)
	(loop until (> aa m) do
	(write-line "foobar...")
	(setq aa (+ aa 1))
	)
)
First thing I do is run SBCL, then (load "foo.lisp")
* (foo-bar 4)
foobar...
foobar...
foobar...
foobar...
NIL
Works OK. But when I do : sbcl foo.lisp, then (foo-bar 4):
* (foo-bar 4)

; in: LAMBDA NIL
;     (FOO-BAR 4)
;
; caught STYLE-WARNING:
;   undefined function: FOO-BAR

;
; caught STYLE-WARNING:
;   This function is undefined:
;     FOO-BAR
;
; compilation unit finished
;   caught 2 STYLE-WARNING conditions

debugger invoked on a UNDEFINED-FUNCTION: The function FOO-BAR is undefined.

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

("bogus stack frame")
0]
What's the difference anyway, between loading file using (load ...) and calling them directly as SBCL's argument.
I thought both do the same thing? :?