Can define-values
be used in internal definitions? For example: (define (test)
(define-values (x y z) (values 1 2 3))
)
>> begin (possibly implicit): no expression after a sequence of internal definitions in: (begin (define-values (x y z) (values 1 2 3)))
But it works in top level definition.
Yes, it can be used in internal definitions. The problem here is exactly what the error message says: the function must return value(s).
(define (test)
(define-values (x y z) (values 1 2 3))
#f)
@sorawee I understand, thanks!
I like the mission control binding though… I’d really like the plain up-arrow to do this, as it does in racket
cli
how are custom keybindings defined?
I can’t see the difference, what am I missing? https://docs.racket-lang.org/style/Textual_Matters.html
Turns out Scribble fixes the bad example.
“Task failed successfully”
Or rather, check the snapshot doc: https://www.cs.utah.edu/plt/snapshots/current/doc/style/Textual_Matters.html?q=style#%28part._.Where_to_.Put_.Parentheses%29
It’s been fixed for a while, but the fix hasn’t made to the release doc (it should within a week?)
no worries, I guessed these were both the ‘good’ form :)
just want to say this slack is great, everyone is so helpful
But I’m not sure that will be sufficient to cover changing the keybinding for arrow keys.
I found there is a count
function can count element by comparing multiple lists. (count equal? list-a list-b)
But it seems that I can’t do the same thing with sequence-count
on multiple sequences. Also can’t do the same with stream-count
.
Is there any suggestion?
(define xs (list 1 2 3))
(define ys (list 1 -2 3))
(sequence-count equal? (in-parallel xs ys))
(define xs (stream 1 2 3))
(define ys (stream 1 -2 3))
(stream-count equal? (sequence->stream (in-parallel xs ys)))
packaging question… I have seen a few packages which have a single main.rkt
with (provides ...)
from various private modules for the public interface of the package is main.rkt
a privileged filename like info.rkt
? or a package will expose the provided names from any files in the top-level dir? …or something else?
Yep. (require abc)
will search abc/main.rkt
only main.rkt
? so every package should have a main.rkt
?
I mean, technically you can ask people to always write (require abc/def)
, and this will look for abc/def.rkt
, so strictly speaking, no.
But usually, it’s easier to write (require abc)
, so most library packages will have main.rkt
There’s also tool packages for DrRacket, and those will have tools.rkt
instead of main.rkt
perfect, thanks