💾 Archived View for idiomdrottning.org › starting-a-new-brev-project captured on 2023-12-28 at 15:31:27. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
Brev has doesn’t have any boiler plate. I just open a project-name.brev file and start hacking. Now that I am using git more, I’ve started making a folder for it first, project-name/project-name.brev. And then I hack away.
I have a shell script that when compiling adds the (import brev mdg) to the top automatically. So I don’t even need to put that in the file. Hello World is just
(print "Hello world")
And then when I am nearing the release stage, I run brev2scm on the brev file.
Since (import brev mdg) is shorthand for “bring in all kinds of batteries ever invented”, but on a more serious, more done project you don’t need all those dependences linked in. Brev2scm asks some questions and then creates a project-name.scm file that handles the module declaration and the few specific imports that particular file needs. (If my file is a stand-alone application rather than a module/library, then I edit the generated .scm file to only have the imports.)
apt-get install chicken chicken-install brev
On zsh, I can just
csc -prologue <(echo "(import brev mdg)") project-name.brev
when I’m doing the prototype and then later on once I’m pretty much done and I’ve ran brev2scm, I can switch to
csc project-name.scm
I’m sure bash has it’s own way of doing that kinda here docs but otherwise brev-prol.scm file with (import brev mdg) first so you can:
csc -prologue brev-prol.scm linen.brev
To just start evaulating things in a REPL, that’s a Chicken app called csi and when I use that, I do call the (import brev mdg) manually.
Here is in my Emacs conf file:
(setq scheme-program-name "csi") (add-to-list 'auto-mode-alist '("\\.brev$" . scheme-mode)) (add-to-list 'auto-mode-alist '("\\.egg$" . scheme-mode))
As I’m hacking, I use cmuscheme in Emacs, and all those dinky li’l “let me just try this function” things, like say you’ve written the function frobnicate, and you write a (frobnicate 1 2 2) to see if you get what you’re expecting, those things I put in a file, it doesn’t matter what it’s called, but it can autogenerate the unit tests with make-tests:
So just evaluate (frobnicate 1 2 2) and stuff in Emacs with scheme-mode and cmuscheme, and let’s say it returns 23 and I’m happy with that, I don’t need to record the 23 just look at it, because then the make-tests will turn it into a test that looks like:
(unless (equal? (frobnicate 1 1 2) 23) (error ...))
This isn’t something I need to think right away other than: all those dumb li’l “test evals”, save them! Don’t delete them. Put them in a toybox.scm or junk.brev or whatever file. And later they can turn into beautiful spun hay-gold by make-tests.