Re: [racket-users] Is it possible to capture a the value of a variable inside a macro?

2021-09-18 Thread Dimaugh Silvestris
Ohhh, thank you so much, Sorawee! Now I have wealth of code to study. By the way, I tried to send my full code but apparently once again I hit the "reply" button instead of "reply all" and I only sent it to David, so here it is again in case anyone wants to play with it. I haven't implemented

Re: [racket-users] Is it possible to capture a the value of a variable inside a macro?

2021-09-17 Thread Dimaugh Silvestris
Thanks, I'll take a look into the code struct++! I'll probably get lost but I'm sure I'll learn something. Answering your questions: A) What exactly are you trying to do, because I think I've got it but I'm >>> still fuzzy. >>> >> Structs that allow constructors like any other function, and

Re: [racket-users] Is it possible to capture a the value of a variable inside a macro?

2021-09-17 Thread Dimaugh Silvestris
still fuzzy. >> B) Why are you trying to do it? >> C) Is there a simpler / more Racket-ish way to do it? >> >> On Thu, Sep 16, 2021 at 2:12 PM Dimaugh Silvestris < >>> dimaughsilvest...@gmail.com> wrote: >>> >>>> Sorry, I haven't posted th

[racket-users] Is it possible to capture a the value of a variable inside a macro?

2021-09-16 Thread Dimaugh Silvestris
(sorry if I'm asking too many questions about macros lately, I'm learning about them but I keep running into scenarios I can't find documentation for) I'm trying to capture the value of a variable whose identifier I can only get with format-id, inside a with-syntax. Something like this pseudocode

[racket-users] gen:custom-write macro

2021-09-01 Thread Dimaugh Silvestris
Tired of writing: #:methods gen:custom-write [(define write-proc (make-constructor-style-printer (lambda (x) blablabla) (lambda (x) blablabla)))] I made this macro: (define-syntax (print-as stx) (syntax-case stx [] {[_ lam1 lam2] #'[(define write-proc

[racket-users] Context aware macro

2021-08-30 Thread Dimaugh Silvestris
I wanted a 'define' that stores in a hash the arguments and the function definition so I don't keep forgetting argument order and having to go to the file and check. So with my very little knowledge of macros, I wrote this: #lang racket (define global (make-hash)) (define-syntax (assign stx)

[racket-users] Re: Packages not being listed after reinstalling

2021-05-15 Thread Dimaugh Silvestris
silly me, I forgot to mention I installed Racket from Guix On Sun, 16 May 2021 at 02:23, Dimaugh Silvestris < dimaughsilvest...@gmail.com> wrote: > I recently did a clean Ubuntu reinstall, but decided this time to try Guix > as a package manager and install as much as possible from

[racket-users] Packages not being listed after reinstalling

2021-05-15 Thread Dimaugh Silvestris
I recently did a clean Ubuntu reinstall, but decided this time to try Guix as a package manager and install as much as possible from there. Guix might be the issue here, perhaps something else. Now I can't run 'raco pkg install', and emacs gives me: ;-- ; Can't suggest packages to

Re: [racket-users] Method gen:custom-write of a struct not working within lists

2021-03-04 Thread Dimaugh Silvestris
On Thu, 4 Mar 2021 at 19:29, Sam Tobin-Hochstadt wrote: > It doesn't print that way because that wouldn't turn back into the > original value when evaluated, since it's quoted. > Is there any other way? If not, I might consider the possibility of having a struct type for each of those ugens,

[racket-users] Method gen:custom-write of a struct not working within lists

2021-03-04 Thread Dimaugh Silvestris
I have a struct defined as: (struct ugen sc.unit (name rate inputs) #:methods gen:custom-write [(define write-proc (make-constructor-style-printer [λ (x) (let [(rate (ugen-rate x)) (name (symbol-append (ugen-name x) ':))] (cond [(eq? rate 'ar)

[racket-users] A real-time Racket?

2021-03-01 Thread Dimaugh Silvestris
I was reading about Extempore, an enviroment for audio and video production in Scheme. Well, almost: it uses something similar to SuperCollider's client-server architechture, with a Scheme interpreter on the client side and a server in a typed Scheme with manual memory management, Xtlang.

[racket-users] Is it possible to define a substruct with the same fields as its superstruct?

2020-12-10 Thread Dimaugh Silvestris
I'm trying different ways to define a struct that has the same fields as its superstruct without adding any new field, but all I get is errors saying struct expects a list of fields. Something like: (struct edible (name grams) #:transparent) and then (struct fruit #:super edible #:transparent)

[racket-users] Suggestions for an additive synth on Racket

2020-12-04 Thread Dimaugh Silvestris
I would like to build an additive synth on Racket, but I can't decide myself wether I should use SuperCollider, Rsound or Fluxus. SuperCollider I've used already with Sclang and Haskell, and I admire it's efficiency, but it has some quirks I dislike (like the order of execution of UGENs). I tried

Re: [racket-users] Passing keywords from a list

2020-11-28 Thread Dimaugh Silvestris
Just in case somebody has a similar issue and finds this: In the end I used keyword-apply/sort , which doesn't requiere keywords to follow the same order they do in the function definition. On Thursday, 26 November 2020 at 10:42:40 UTC+1 Dimaugh Silvestris wrote: > Thanks! Your answer led

Re: [racket-users] Passing keywords from a list

2020-11-26 Thread Dimaugh Silvestris
(for/hash ([chunk (in-slice 2 args)]) > (values (first chunk) (second chunk > > (keyword-apply/dict proc args* '()) > > > On Thu, Nov 26, 2020 at 12:53 AM Dimaugh Silvestris > wrote: > >> Is it possible to reproduce this behavior >> ((lambda (#:colo

[racket-users] Passing keywords from a list

2020-11-26 Thread Dimaugh Silvestris
Is it possible to reproduce this behavior ((lambda (#:color color #:size size) (display (cons color size))) #:color "red" #:size 3) when what I have is a list such as '(#:color "red" #:size 3) ? How can I feed keyword arguments stored in a list as symbols in a way that doesn't involve parsing

Re: [racket-users] Re: Copy keybinding in DrRacket not working

2020-11-23 Thread Dimaugh Silvestris
Sun, Nov 22, 2020 at 7:45 PM Dimaugh Silvestris > wrote: > >> So I tried adding a custom keybinding using c:c, and now when I open >> DrRacket, I get the error: >> <> /home/dimaugh/prog/rkt/keybindings.rkt: >> map-function in keymap%: "c:c" is alrea

[racket-users] Re: Copy keybinding in DrRacket not working

2020-11-22 Thread Dimaugh Silvestris
rRacket, I get the error: <> But after clicking the OK button I can use DrRacket, and Control+c works as it should. The error message bothers me a bit, but other than that it's now solved. On Sunday, 22 November 2020 at 16:49:38 UTC+1 Dimaugh Silvestris wrote: > > For some reason, C

[racket-users] Copy keybinding in DrRacket not working

2020-11-22 Thread Dimaugh Silvestris
For some reason, Control+c isn't working in DrRacket, while Control+x for cut and Control+v work as expected. I think I've had this since I installed DrRacket, and I haven't changed anything about keybindings that I remember; I've been using the right-click menu instead, but it's cumbersome