!iNkFOAFNSlAAUKgcCT:matrix.org

lisp

61 Members
All things lisp: cl, scheme, racket, clojure etc8 Servers

Load older messages


Timestamp Message
20 Oct 2019
16:50:20@wing_v:matrix.null.lovewing_v joined the room.
22 Oct 2019
06:15:58@fouric:riot.firechicken.netfouricdoes anyone have opinions about my attempt to turn the cl-sdl2 with-event-loop loop into a recursive function? https://gist.github.com/fouric/8068a1ce3e9a0ae8ce664c2b182b2e1d
06:16:55@fouric:riot.firechicken.netfourici feel like i could somehow separate out all of the boilerplate (like allocating the sdl-event struct and handling lisp messages) but i can't figure out how
06:17:16@fouric:riot.firechicken.netfouricthe original macro definition is at https://github.com/lispgames/cl-sdl2/blob/a963ea57c7d43761f28314f0642fcae18fb51174/src/events.lisp#L189
06:17:38@fouric:riot.firechicken.netfouricand you might use it like https://github.com/lispgames/cl-sdl2/blob/a963ea57c7d43761f28314f0642fcae18fb51174/examples/basic.lisp#L50
07:01:49@luismbo:matrix.orgluismboThe first thought that comes to mind is that tail recursion is not mandatory so you might end up with actual recursion and overflow the stack.
07:03:27@fouric:riot.firechicken.netfouricI'm assuming the implementation has TCO
07:04:08@fouric:riot.firechicken.netfouricthe reason I'm rewriting it in loop form at all is so I can hotpatch the event-processing logic while the program runs
07:04:13@fouric:riot.firechicken.netfouricI guess I should have explained that
07:04:51@fouric:riot.firechicken.netfouric* I'm assuming the implementation has TCO
07:07:42@luismbo:matrix.orgluismbo Can you have your cake and eat it too? If TCO kicks in, you won't be able to redefine the inner function midway through the loop, right?
07:08:03@luismbo:matrix.orgluismbo🤔
07:12:31@luismbo:matrix.orgluismbo Couldn't you simply move the looping to the outer function and have the inner function's return value determine whether the loop should stop?
07:13:15@luismbo:matrix.orgluismboIn any case, your code looks much better than that huge original macro. 👍
23 Oct 2019
00:49:19@fouric:riot.firechicken.netfouric
In reply to @luismbo:matrix.org
Can you have your cake and eat it too? If TCO kicks in, you won't be able to redefine the inner function midway through the loop, right?
Yup! I've done exactly this before and it works flawlessly - at least on SBCL, which is the thing I'm concentrating on right now.
00:49:52@fouric:riot.firechicken.netfouric That is, I both get TCO, and I gain the ability to redefine loop-like constructs while they're running.
00:50:02@fouric:riot.firechicken.netfouricerm, i get the latter as a result of the former
00:51:33@fouric:riot.firechicken.netfouric the problem is that almost half of INNER is just the SDL2 boilerplate, and i want to move it into a separate macro - but i can't figure out what the macro should look like
25 Oct 2019
02:19:13@willghatch:matrix.orgwillghatch joined the room.
26 Oct 2019
18:51:53@eriix:v20190530.eriix.orgeriix changed their display name from eriix to eriix (Old).
18:54:35@eriix:v20190530.eriix.orgeriix invited @eriix:eriix.orgeriix.
20:07:14@eriix:v20190530.eriix.orgeriix changed their display name from eriix (Old) to eriix.
29 Oct 2019
15:30:53@v:le.chat.vegai.fivegai joined the room.
4 Nov 2019
19:09:09@fouric:riot.firechicken.netfouric changed their display name from fouric to DaemonFC.
21:05:58@fouric:riot.firechicken.netfouric changed their display name from DaemonFC to fouric.
6 Nov 2019
08:50:41@thomroh:chat.weho.stthomroh joined the room.
7 Nov 2019
19:43:36@fouric:riot.firechicken.netfouric changed their display name from fouric to DaemonFC.
19:49:22@fouric:riot.firechicken.netfouric changed their display name from DaemonFC to fouric.
9 Nov 2019
03:38:40@davidpgil:matrix.orgdavidpgil left the room.
11 Nov 2019
02:02:49@julienrouse:matrix.orgjulienrouse joined the room.

There are no newer messages yet.


Back to Room List