@badkins @wanpeebaw Thank you very much, the information helped me a lot, I was able to make the code :smiley:. Now I have another question by chance, do you have examples or do you know where I can see examples of how I can repeat a function? like a loop For example, a function that removes the largest number from three lists, but the action repeats up to 0 or is empty. thanks.
@dcmicoltacespedes here’s an example of repeating the drop
function on three lists concurrently: (define (drop-3 l1 l2 l3)
(if (or (null? l1) (null? l2) (null? l3))
(values l1 l2 l3)
(drop-3 (drop l1 1)
(drop l2 1)
(drop l3 1))))
(drop-3 '(1 2 3) '(4 5) '(6 7 8 9))
So, you can simply replace drop
with a function that does what you want e.g. removing the largest number.
Thank you. I have a question, values
, is it to save the results of each list? or what do values
do?
The drop-3
function needs to return 3 lists. One way to do that is with (values l1 l2 l3)
, another way to do that is to put the 3 lists in another list (list l1 l2 l3)
. values
will return multiple values, where list
will return one value which is a list of lists.
Using values
might be a little more efficient since it won’t allocate a new list object, but either one is fine.
Here’s an example of making use of the values: (let-values ([ (l1 l2 l3) (drop-3 '(1 2 3) '(4 5) '(6 7 8 9)) ])
(println l1)
(println l2)
(println l3))
I am having trouble creating a standalone runnable from my racket code. On trying raco exe
or even raco distribute
, I got a file. But on trying to execute it, this is what I keep getting collection-file-path: collection not found
collection: "portaudio/lib"
in collection directories:
context...:
/Applications/Racket v7.7/collects/racket/private/collect.rkt:26:58: fail
'#%embedded:portaudio/portaudio:: [running body]
temp35_0
for-loop
run-module-instance!
for-loop
[repeats 1 more time]
run-module-instance!
for-loop
[repeats 1 more time]
run-module-instance!
for-loop
[repeats 1 more time]
run-module-instance!
for-loop
[repeats 1 more time]
...
Can’t find anything on the internet as to why this is happening. Any help?
the code runs perfectly fine when I run it using racket <filename>.rkt
What operating system?
Mac OSX, Catalina.
For ref, here is the (bad) code: https://github.com/Hallicopter/MPEGMafia/blob/master/bin/mpegmafia.rkt
I’m running MacOS Catalina. I never create executables, but I just tried a hello world to make sure there wasn’t a file permission problem with Catalina (since they locked things down so much). My hello world worked fine using Racket 7.5 BC, so the general mechanism seems ok. In your case, there appears to be a problem finding a package, so you may need to supply an option.
I expect others can provide better help, but maybe try --embed-dlls
to see if it helps?
oops - never mind, that appears to be Windows specific
I am not able to understand what this error message means, I am guessing rsound depends on port audio, and something is wrong with that, but then again, no idea how to fix it. I figured raco would take care of all dependencies
This seems at least somewhat related: https://groups.google.com/forum/#!topic/racket-users/srVby-5HbT8 if so, it may be a problem with rsound.
My guess is that rsound or portaudio is doing something that doesn’t play well with raco exe.
Perhaps @jbclements could help more
@jbclements has joined the channel
Hmm, having a tough time making the project easy to install. Trying to make a home-brew formula for it, but that’s also tough, since I have never done that before either.