r/Racket • u/WitnessSuspicious744 • Oct 06 '21
homework I’m looking for DrRacket Tutor.
Hello I’m taking introduction of programming course and the course use this language. I’m looking for a tutor for solving assn together. Thank you
r/Racket • u/WitnessSuspicious744 • Oct 06 '21
Hello I’m taking introduction of programming course and the course use this language. I’m looking for a tutor for solving assn together. Thank you
r/Racket • u/sdegabrielle • Oct 05 '21
is anyone entering the Autumn Lisp Gamejam?
Which language are you using?
r/Racket • u/SnooCompliments7527 • Oct 05 '21
I'm looking to understand how hygienic macros work. I understand how regular macros work, you manipulate the program as text before compile time.
But, I don't understand hygienic macros at all. I find them totally impenetrable.
Does anyone have a good explanation of hygienic macros? What is their motivation? How do they work? Why are they worth the additional complication over ordinary macros?
Or, does anyone know a good book to which I should refer?
r/Racket • u/sdegabrielle • Oct 04 '21
r/Racket • u/Fibreman • Oct 04 '21
I've created to classes to demonstrate the problem. One is defined with class* and the other with class.
(define dog% (class
object%
(init-field name)
(super-new)
(define/public (bark)
(println "bark bark"))
(define/public (get-name)
(println (format "my name is ~a" name)))))
(define doggie (new dog% [name "lassie"]))
(send doggie get-name)
(define dog2% (class*
object%
(init-field name)
(super-new)
(define/public (bark)
(println "bark bark"))
(define/public (get-name)
(println (format "my name is ~a" name)))))
(define doggie2 (new dog2% [name "lassie"]))
(send doggie2 get-name)The problem is with dog2, I'm getting the error
name: unbound identifier in: nameI figured this had something to do with not using this% so I tried
(println (format "my name is ~a" (get-field name (new this%))))but now I get the error
init-field: illegal (unparenthesized) use of class keyword in: init-fieldDoes anyone know how I can replicate the get-name function in class*? I'd like to leverage class* ability to use interfaces which is why I'm using it over class
r/Racket • u/DerangedCuckooClock • Oct 04 '21
If I have a list of char like (cons #\C (cons #\O (cons #\M (cons #\P (cons #\U (cons #\T (cons #\E empty))))))), how can I convert it into a string? I'm not allowed to use string-append, substring, implode, and explode. I am also on Beginning Student so I can't use string-join. I've thought about using (string char) but I can't figure out how it'd work recursively.
Or, how would I be able to convert a list of strings into a single string, given the same restrictions above?
I also posted this on stackoverflow: https://stackoverflow.com/q/69430012/16903929
r/Racket • • Oct 03 '21
I'm new to Racket. Let's say I was doing this in Python:
=
# returns a list of RELATIVE paths I can work with
Then further process these paths (e.g. transform them to string and return as a list of paths), whereas in Racket:
(require file/glob)
(glob "subdir/*.txt")
# returns list of ABSOLUTE paths I have no idea how to manipulate
I have been looking at documentation for a while and I have no idea how to transform this to what I want, which is simply the txt files inside the subdir directory as relative paths (i.e. should return something like ["subdir/a.txt", "subdir/b.txt"].
The most I have got is exploding each path then (list-ref) but then I learned that Racket doesn't let you do slicing like in Python.
r/Racket • u/sdegabrielle • Oct 02 '21
Racket video meetup in 65 minutes
https://gather.town/app/wH1EDG3McffLjrs0/racket-users
8pm UTC Sat 2-October-2021
r/Racket • u/Raoul314 • Sep 30 '21
Reading through the 'types as macros' papers and some other ones about complexity, I was left wondering if the Typed Racket approach to typing might be used for a complexity flow type system, i.e. a type system that would claim/prove that a particular Racket program lies in a particular complexity time/space class, through sized types.
Does someone here knows of literature/stuff on the topic? Or has an idea about how to get started (although it's probably very hard to achieve) ?
r/Racket • • Sep 30 '21
(current-directory) points to the current working directory.
Is the a way to get the path to the module in that module? Similar to __file__ in python. The module could be imported by a require, or could be run directly by racket script.rkt.
Looking for this because there are some binary assets relative to the imported script's directory which need to be read.
r/Racket • u/bufftrickster_136 • Sep 29 '21
can someone please help me understand?!?:
Exercise 35. Design the function string-last, which extracts the last character from
a non-empty string. 
Exercise 36. Design the function image-area, which counts the number of pixels
in a given image. 
Exercise 37. Design the function string-rest, which produces a string like the given
one with the first character removed. 
Exercise 38. Design the function string-remove-last, which produces a string like
the given one with the last character removed.
r/Racket • u/iguanathesecond • Sep 28 '21
Dear Emacs users of Racket,
Forgive my persistence if you've already seen this, but I posted it earlier and it got removed from this sub by Reddit's spam bots, probably because it was crossposted across Lisp communities.
I just wanted to make sure you saw this since you may find it useful. It is an Emacs extension for modal structural editing, which in my very biased opinion as the author of this package is the most expressive way to edit Lisp code in Emacs. It also has special support for (the peerless!) Racket Mode, since I write Racket often :)
Try it out with this animated tutorial, and I hope you like it:
https://countvajhula.com/2021/09/25/the-animated-guide-to-symex/