
This is probably an odd question: is there a way to make a function contract that checks a parameter at the time of function call? I’m guessing that some kind of chaperone is needed?

@tosxychor has joined the channel

See #:pre in ->i

To clarify, I was referring to the README.md in the aforementioned fork, not the main frog repo.

@greg thanks for your efforts on Frog. I spent a few hours moving some old blog posts into it, and I think it will do nicely for what I need. Unless I stumble into some showstopper (highly unlikely), I expect I’ll move my main blog over to it. I noticed a comment (maybe on github?) about a forum, but what do you think about simply having a #frog channel in this Slack for Frog users to communicate? That seems pretty low friction to me.

@arjunubc has joined the channel

Thanks for clarifying, but I did understand you were talking about the fork’s readme. I was just reminiscing.

I don’t have any thoughts about a #frog
channel here. Probably I wouldn’t monitor it but if other folks find it useful that’s great.

The current “app treadmill” I’ve been on for some years now is Racket Mode. There’s still a lot to do, with that, and that’s about the limit of my focus lately.

@matthew.smith16 has joined the channel

Hi, so I am working on adding some functionality to a Racket package. I am trying to add a function to package “X”, a function such as (define (myBasicTestFunction) (printf "Hello from Package X"))
My question is after I have updated the source file, how to I then build it so that the changes are “live”? So if I ran >racket myTestProg.rkt
Which looks like #lang racket
(require X)
(myBasicTestFunction)

how did you install “X”? And where is the file that you edited?

X is any arbitrary package that comes with Racket under share/pkgs
and the file is any source file in said package

Say that package X is sgl
under share/pkgs/sgl
and the file was sgl.rkt

so at the bottom of sgl.rkt
I added ...
(define (myBasicTestFunction) (printf "Hello from Package X"))

and now myTestProg.rkt
would look like #lang racket
(require sgl)
(myBasicTestFunction)

so if I run >racket myTestProg.rkt
it outputs >racket myTestProg.rkt
myTestProg.rkt:3:1 myBasicTestFunction: unbound identifier
in: myBasicTestFunction
location...:
myTestProg.rkt:3:1

How do I rebuild the package so that my changes are “live”?

raco setup --pkgs sgl
might work, but more importantly, you should never edit any file in share/pkgs
. Instead, run raco pkg update --clone sgl
at your working directory to create a copy of sgl
that you can edit.

gonna test and sign-into slack from the vm I am working in

ok so I know what you are saying about not editing share/pkgs
, I read that in the documentation, I do run into problems when running raco pkg update --clone sgl
however. >raco pkg update --clone sgl
Inferred package name from given `--clone' path
package: sgl
given path: sgl
Inferred package scope: installation
raco pkg update: package is not currently installed from a repository
package: sgl
current installation: (catalog sgl)

I can just use git
to clone the repo and then “point” raco to the local copy right?

It’s likely that you will get an installation conflict if you just use git to clone the repo fresh.

I installed Racket from source, which might explain why raco pkg update --clone sgl
works for me and not for you. I don’t know what’s the right solution for you though.
Though this paragraph:
> This same approach will generally work if you’re starting from a distribution installer instead of the checkout of the Racket sources from the main Git repository. from https://docs.racket-lang.org/racket-build-guide/contribute.html
suggests that it should work…

I built racket from source also…. I downloaded it from https://download.racket-lang.org/ and selected Unix-Source + built packages
and then ran mkdir build
cd build
../configure
make
make install

Oh, by built from source, I meant clone Racket from GitHub.
If I were you, I will go with a different route:
- Download Minimal Racket from https://download.racket-lang.org/ (which does not come with
sgl
). git clone <https://github.com/racket/sgl.git>
cd sgl
/path/to/minimal-racket/bin/raco pkg install

Ok I will try that

does make clean remove the current installation of racket?

I don’t know.. I have never done that.

ok I just didn’t want to have to roll back the VM that far back

so should I download Source + built packages
or just Source
?

Oh, there’s no need to download source

Well, depends on what platform you are in.

For example, I’m using Mac OS, so I just download dmg
installer

IIRC Linux has a .sh
installer.

Note that this should be minimal Racket, not full Racket.

Good luck, I gotta go now.

yeah I got it

thanks for your help

So I have downloaded and installed minimal racket
, cloned the package sgl
, and installed it using raco pkg install
. I can see it via raco pkg show
which outputs Installation-wide:
Package Checksum Source
racket-lib 28d0cbe906278e8dc6549010f0f422c5bcde25f4 catalog racket-lib
User-specific for installation "7.9":
Package Checksum Source
sgl link /home/mint/sgl
[115 auto-installed packages not shown]
anytime I make a change to a source file in the sgl directory i.e adding a basic function to sgl.rkt
such as (define (myFunction) (printf "Hello from sgl"))
I have been using raco setup --pkgs sgl
to compile/build/etc
the package. However, racket
does not seem to reflect the changes that I have made to the source file. As demonstrated from so: $ racket
Welcome to Racket v7.9 [bc].
> (require sgl)
> (myFunction)
; myFunction: undefined;
; cannot reference an identifier before its definition
; in module: top-level
; [,bt for context]
>
How do I compile or build the source code that then is reflected in the actual racket runtime?

Did you provide
myFunction
?

And just to make sure we are on the same page, the racket
executable starts the minimal Racket that you just downloaded, correct?

- What do you mean by provide?
- It is the only racket that is currently installed on the system so yes…

Sorry for the delayed responses I am making a pizza


If you change the code to:
#lang scheme/base
(require (prefix-in gl- "sgl.rkt"))
(provide (all-from-out "sgl.rkt")
my-function)
(define (my-function)
(displayln "Hello from sgl"))
Then you should be able to use my-function
when you (require sgl)
.

ok I will test

so yeah that works!

Welcome to Racket v7.9 [bc].
> (require sgl)
> (my-function)
Hello from sgl
>

Do you perhaps know why that works from main.rkt
and not from sgl.rkt
?

The file main.rkt
prefixed all exported symbols from sgl.rkt
with gl-

So try gl-myFunction
?

But note that you need to provide
from sgl.rkt
too.

Alternatively, when you require, you should reference sgl.rkt
via (require sgl/sgl)

For the latter, you don’t need to prefix symbols with gl-

I was reading about the prefix stuff but adding the function (define (my-function)
(displayln "Hello from sgl"))
to sgl.rkt
and then calling it from racket still was not available even when (requiring sgl/sgl)
Welcome to Racket v7.9 [bc].
> (require sgl/sgl)
> (my-function)
; my-function: undefined;
; cannot reference an identifier before its definition
; in module: top-level
; [,bt for context]
> (gl-my-function)
; gl-my-function: undefined;
; cannot reference an identifier before its definition
; in module: top-level
; [,bt for context]
>

ok

I found out why

the signature inside of sgl.rkt
needs to look like so (provide my-function)
(define (my-function)
(displayln "Hello from sgl"))
and the calling site need to be like so (require sgl)
(gl-my-function)
Hello from sgl

Thank you for all your help I feel much better about the whole ordeal