We’ve been working on a project for the past few weeks! It has tied up how often we can do the podcast, but we plan on posting every Monday again until we can ramp up season 2!
That Animated Podcast
What Happened to That Animated Podcast?
2 responses
enjoy the show❤️
view responses
-
I have been reading Scheme Primer. Most people make the mistake by learning C# or Python first. Those languages are not intuitive. In C and C++ you do everything in loops, by creating and modifying temporary variables. It established unconscious unprecedented assumption the only solution is found by making a loop with temporary modifiable variables. If playing around with a programming language is not fun, then it is not good. That’s why I love Guile (not related to the Street Fighter character). I don’t have any major plans to make games, if I do they will be terminal/ command line based. I could learn how to use the SDL library. And instead of using a game engine, such as Godot, I would have to program the graphics myself.
For example:
“`
(use-modules (sdl2)
(sdl2 render)
(sdl2 surface)
(sdl2 video))(define (draw ren)
(let* ((surface (load-bmp “hello.bmp”))
(texture (surface->texture ren surface)))
(clear-renderer ren)
(render-copy ren texture)
(present-renderer ren)
(sleep 2)))(sdl-init)
(call-with-window (make-window)
(lambda (window)
(call-with-renderer (make-renderer window) draw)))(sdl-quit)
“`
This Guile code will create a window the size of a provided “hello.bmp” file and close after 2 seconds. Intriguing part is the denotation of let*. In the world of C# and other ALGOL-like languages it is a weird little function. For instance:
“`
(let* ((name “Dalton”)
(greeting
(string-append “Hello ” name “!”)))
(display greeting)) ; print greeting to screen
; prints: Hello Horace!
“`
Essentially let* defines a temporary, one-time-use function, that can refer bindings to refer to previous bindings. You set a variable name as “Dalton”. Inside that you define a variable greeting, which is just 3 strings “Hello “+”Dalton”+”!” appended to each other. Then you print it. All inside a single function!Then what is define? That’s the function for creating functions. In this instance with variables draw and ren.
There is also things such lambda, which I won’t go into detail, but it is essentially the building block of the entire language. All the abstraction in Guile is built on top of lambda. To have a powerful language you just need few building blocks. Everything else is just simplifying it.
“`
(define (greet name)
(display (string-append “Hello ” name “!”))); (greet “Dalton”)
; => Hello Dalton!
“`
That was just a nicer way to write:
“`
(define greet
(lambda (name)
(display (string-append “Hello ” name “!”))))
“`
Both are working examples. You can test out in rextester.com/l/scheme_online_compiler!Did I black out again?
Leave a Reply
You must be logged in to post a comment.