I installed the sbcl v2.3.3 MacPorts port on my Mac (OSX 10.15.7) for the purposes of this answer.
First, I created a file test.lisp
with the contents:
(count-matches "\\w*" "foo bar baz")
as suggested in the question. Next, I started a REPL by selecting Tools → SublimeREPL → Common Lisp → SBCL
. This appeared in a new tab:
This is SBCL 2.3.3, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
*
Switching back to test.lisp
, I selected Tools → SublimeREPL → Eval in REPL → File
and got this:
* (count-matches "\\w*" "foo bar baz")
; in: COUNT-MATCHES "\\w*"
; (COUNT-MATCHES "\\w*" "foo bar baz")
;
; caught STYLE-WARNING:
; undefined function: COMMON-LISP-USER::COUNT-MATCHES
;
; compilation unit finished
; Undefined function:
; COUNT-MATCHES
; caught 1 STYLE-WARNING condition
debugger invoked on a UNDEFINED-FUNCTION @52A00904 in thread
#<THREAD "main thread" RUNNING {10013B0003}>:
The function COMMON-LISP-USER::COUNT-MATCHES is undefined.
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [CONTINUE ] Retry calling COUNT-MATCHES.
1: [USE-VALUE ] Call specified function.
2: [RETURN-VALUE ] Return specified values.
3: [RETURN-NOTHING] Return zero values.
4: [ABORT ] Exit debugger, returning to top level.
("undefined function" "\\w*" "foo bar baz")
0]
I then typed in 4 and the prompt changed back to *
.
If I started a fresh SBCL REPL and instead chose Tools → SublimeREPL → Transfer to REPL → File
, it copied the contents of the file to the *
prompt, and I had to hit Enter for it to evaluate. The same debugger message as above came up, and entering 4
successfully brought me back to the *
prompt.
While searching for lisp
on Package Control, I came across Slyblime
, a port of Sly to Sublime Text 4 (make sure you are using build number 4000 or greater - Sublime Text → About Sublime Text
on Mac, Preferences → About Sublime Text
on Windows/Linux). Slyblime is built on top of SublimeREPL and adds additional features. I don't know enough about Lisp to make use of it or judge its utility, I just thought I'd mention it here.