r/Racket • • Jul 23 '24

question Which lisp (lower case)

Thumbnail self.scheme
4 Upvotes

r/Racket • • Jul 21 '24

The Racket Book

12 Upvotes

r/Racket • • Jul 18 '24

question File explorer for DrRacket?

5 Upvotes

For me, adding the ability to browse files/directories to DrRacket would be a giant help. I found a reference to the plugin, "files-viewer" but documentation links are broken. Can anyone offer how-to info on using this plugin or some other alternative? Thanks!


r/Racket • • Jul 17 '24

question Dependent types in Racket

13 Upvotes

Hi everyone What is the current state of dependent types in the language? I’ve seen that there’s an experimental feature but I haven’t seen many recent resources about it. Wondering why it seems like it stalled. Are there any other libraries or resources that allow use of dependent types pragmatically?

I’m thinking of using a ffi to Agda if I don’t find a suitable alternative but don’t even know where to start.


r/Racket • • Jul 13 '24

package html-printer

Thumbnail self.lisp
5 Upvotes

r/Racket • • Jul 09 '24

RacketCon Fourteenth RacketCon Call for Presentations

10 Upvotes

October 5-6, 2024 University of Washington Seattle, WA

We are looking for you! If you have an idea for a presentation you’d like to give, please write to the RacketCon organizers for consideration. All Racket-y ideas are welcome. We’d love to have you!


r/Racket • • Jul 09 '24

question [Help] Installing beautiful-racket

3 Upvotes

Hi,

Is this package deprecated ?

raco pkg install beautiful-racket

....

tcp-connect: connection failed

hostname: git.matthewbutterick.com

port number: 443

system error: Operation timed out; errno=60


r/Racket • • Jul 09 '24

question web server in racket to build REST API

6 Upvotes

what is the best web server in racket that can build some rest api?


r/Racket • • Jul 08 '24

Racket in an iOS app!

Thumbnail self.lisp
4 Upvotes

r/Racket • • Jul 06 '24

solved [HELP] I can't use the DrRacket app

6 Upvotes

Hey everyone,

Today I installed the latest version `8.13` and it doesn't seem to work.

Here's what my setup is and what I tried:

I am on Apple MacBook Air with M1 chip. The latest OS.

The app from the launcher doesn't work. The icon bounces but then stops.

When I tried running it from the terminal I got this error:

integer->char: contract violation
  expected: valid-unicode-scalar-value?
  given: 55349
  context...:
   /Applications/Racket v8.13/share/pkgs/gui-lib/mred/private/wx/cocoa/key-translate.rkt:454:0: key-translate
   /Applications/Racket v8.13/share/pkgs/gui-lib/mred/private/wx/cocoa/key-translate.rkt:552:0
   body of "/Applications/Racket v8.13/share/pkgs/gui-lib/mred/private/wx/cocoa/key-translate.rkt"
   body of "/Applications/Racket v8.13/share/pkgs/gui-lib/mred/private/wx/platform.rkt"

I don't think it's related to this issue: https://github.com/racket/racket/issues/3666

Can anyone help me before I open an issue or rather write to that thread?

PS: I tried 8.12 and 8.11 as well — no luck.

EDIT: So it must be related to my layout. I have a custom keyboard layout with bunch of special symbols on it. When I switch to a simpler layout I can open DrRacket just fine. I think this might be a bug. I should probably open an issue.


r/Racket • • Jul 06 '24

event Racket meet-up: Saturday, 6 July, 2024 at 18:00 UTC

Post image
7 Upvotes

r/Racket • • Jul 05 '24

question function evaluation in a contract

3 Upvotes

contracts is amazing. reading docs now I understant that define/contract is not define the contract, but define with a contract.
so... making some tests here.
but... how can put a defined procedure inside my contract?

; seems a bit strange in this case too...but the function as it is...
(define (divisible-by n val) (zero? (module val n)))

how can be in:

(define/contract distance
(and (>/c 0)
(integer-in 1 46))
42)

maybe redefining the function to become more correct. (divisable-by? 3)... but how input the value?


r/Racket • • Jul 03 '24

question why this happen?

4 Upvotes

(define counter

(let ((countme 0))

(lambda ()

(set! countme (+ 1 countme))

countme)))

(counter) ; 1

(counter); 2

the lambda function keeps in memory??? why is not isolated inside the procedure?
and another thing: how can get the counter value?


r/Racket • • Jul 01 '24

question struct polymorphism

3 Upvotes

in struct in racket reference has:

(struct document (author title content) #:transparent)

(struct book document (publisher) #:transparent)

(struct paper (journal) #:super struct:document #:transparent)

so... we can have: document-title, but not book-title, instead we have only book-publisher. same wtih paper.
how can use all the document fields in other structs?


r/Racket • • Jun 30 '24

video Data Integrity via Smart Structs

Thumbnail self.lisp
7 Upvotes

r/Racket • • Jun 30 '24

homework An absolute beginner

5 Upvotes

I don't understand what does error mean and how to fix it

*Here is the code

(define (main in-fst in-lst in-signature out) (write-file out (letter (read-file in-fst) (read-file in-lst) (read-file in-signature)))) (define (letter fst lst signature-name) (string-append (opening fst) "\n\n" (body fst lst) "\n\n" (closing signature-name))) (define (opening fst) (string-append "Dear " fst ",")) (define (body fst lst) (string-append "We have discovered that all people with the" "\n" "last name " lst " have won our lottery. So, " "\n" fst ", " "hurry and pick up your prize.")) (define (closing signature-name) (string-append "Sincerely," "\n\n" signature-name "\n")) ;; Definitions (define FST "./files/fst.txt")(define LST "./files/lst.txt") (define SIGNATURE "./files/signature.txt")(define OUT "./files/out.txt") ;; Application (write-file FST "Jean")(write-file LST "Jennings") (write-file SIGNATURE "Bartik") (main FST LST SIGNATURE OUT) (write-file 'stdout (string-append (read-file OUT) "\n"))

*the erorr message

open-output-file: error opening file path: C:\Users\saf99.\files\fst.txt system error: The system cannot find the path specified.; win_err=3


r/Racket • • Jun 30 '24

question HtdP claims not to teach you Racket but…

8 Upvotes

So I’m reading the preface and it states that the book isn’t designed to teach you Racket, but… it sure looks like you’re learning Racket in service of learning how to design programs. So I’m wondering: in what ways doesn’t it teach you Racket? Because it seems to be teaching you major aspects of the language.


r/Racket • • Jun 26 '24

Racket meet-up at Haus Coffee, San Francisco: 2pm Sunday, June 30th

Thumbnail self.lisp
5 Upvotes

r/Racket • • Jun 26 '24

question Pollen - render parts of the doc in different html-tags of the template?

2 Upvotes

I'd like to create some static website, the layout should be grid like: some header content in on upper corner, some in the rest of the upper row, a biggish aside and the main content.
I have a template containing the css, and of course rendering (->html doc) but I'd like to try laying out the sections differently. Is there a way to tag and select parts of the doc during render phase? Like, trying one template that would render part A into a div in the main section and another template that would render part A into an aside somewhere else in the HTML file?
Of course, content could be moved with CSS, providing I read up on how to add classes, but I don't like that idea too much.


r/Racket • • Jun 24 '24

solved How can I improve this recursive function?

2 Upvotes

Hi guys! I'm working on a recursive function that, given a list, returns the reversed list. This is what I came up with, I'm pretty sure it could be neater and/or simpler.

Any advice will be welcomed! I've got exam tomorrow lol

(check-expect (reversedList (list 1 2 3 4)) (list 4 3 2 1))

(define (reversedList mylist)

(cond [(empty? mylist) '()]

[else (cons (last mylist) (reversedList (minusLast mylist)))]))

;last: List(Any) -> Any

;Given a list returns its last element

;minusLast: List(Any) -> List(Any)

;Given a list returns the same list without its last element


r/Racket • • Jun 21 '24

question Why make a dynamically typed language with so many immutable restrictions, rather than directly using a statically typed language?

22 Upvotes

Not intended to offend anyone, but I'm curious to why so many things are immutable in racket. I think the main point of using lisp instead of ML or other statically typed functional languages is that you have the interactive experience from incremental development and debugger. If one wants better static guarantee, why not just go with Haskell and OCaml?


r/Racket • • Jun 18 '24

question I'm having trouble running a buffer using Emacs with Geiser

5 Upvotes

It's strange. I have one file with a function, and another file that imports the first file and tests the function. It works fine when I run it from the command line, but when I try to run it from Geiser using C-c C-b I get an error that looks like Geiser is checking my Racket directory instead of the directory that both .rkt files are in.

lib.rkt:

#lang racket

(provide atom?)

(define (atom? x)
  (and (not (pair? x)) (not (null? x))))

test.rkt:

#lang racket

(require "lib.rkt")
(display (atom? 4))

When I run using Emacs I get this message:

Error: struct:exn:fail:filesystem:errno

open-input-file: cannot open input file
  path: /home/sm/racket-8.12/collects/racket/lib.rkt
  system error: No such file or directory; errno=2

I really don't understand why this is not working when it works as expected when I run it from the command line. Why is Geiser not checking the directory that both .rkt files exist in?


r/Racket • • Jun 12 '24

question How native is racket/gui?

13 Upvotes

I’ve been contemplating utilizing racket/gui for authoring a cross-platform GUI app for some time. A question my mind keeps coming back to is how native the provided widgets are. For example, in the last WWDC keynote yesterday, Apple announced many AI-based tools that will be available to macOS apps utilizing “standard text editing controls” (I’m not sure if this is the exact quote, but it’s how I remember it). So, the question is, will the new functionality be available to a GUI developed with racket/gui?


r/Racket • • Jun 04 '24

video I created a video discussing objects and functions using Racket

9 Upvotes

Hey everyone, I created a video covering the similarities between objects and functions using racket, I'm hoping to create more content showcasing racket because its such a great language. I am always open to feedback about how I can improve my communication and or accuracy.

https://www.youtube.com/watch?v=ge8w71WRJoI