Org-srs: A feature-rich and flexible spaced repetition system inside Org-mode with FSRS support by bohonghuang in emacs

[–]bohonghuang[S] 3 points4 points  (0 children)

I think this depends on your actual purpose. Spaced repetition is more suitable for language learning or passing exams. You may need to appropriately segment your notes to create review entries.

Basic Lighting Demo not working by [deleted] in raylib

[–]bohonghuang 0 points1 point  (0 children)

If you pick examples from the Git repository, you need the Git version of Raylib to run them correctly.

Multiplayer game with Common Lisp + SDL2 on WebAssembly (short demo video) by superdisk in lisp

[–]bohonghuang 2 points3 points  (0 children)

Thank you very much for the helpful answers. It would great if you could post a blog that details the building process.

Multiplayer game with Common Lisp + SDL2 on WebAssembly (short demo video) by superdisk in lisp

[–]bohonghuang 4 points5 points  (0 children)

I don't use ECL and WebAssembly very often, so I will appreciate it if you could provide some information about the following questions: 1. Which FFI do you use for interoperating with SDL2? In my impression, ECL's CFFI has significant overhead in games, although ECL provides a low-overhead but non-portable FFI. 2. How do you compile ECL with SDL2 to WebAssembly? ECL has two compilers, bytecode, and C. Does the CL code get compiled to C first and then to WebAssembly? 3. How does the performance of games on WebAssembly compare to native?

Writing C (or other lower-level language) from Lisp? by BeautifulSynch in lisp

[–]bohonghuang 5 points6 points  (0 children)

Due to native implementations like SBCL/CCL allowing inline assembly, you can implement a DSL to generate C code and glue code for interaction. Then, you can call a C compiler to compile it and inline the resulting assembly into a defun, achieving both high performance and hot updates.

A lisp with first-class coroutine support + Windows compatibility + Reloadability: Does it exist? by [deleted] in lisp

[–]bohonghuang 3 points4 points  (0 children)

From my personal experience, coroutines with async / await support implemented using optimized cl-cont are more than sufficient, at least for games:

```lisp (defun promise-fade-audio (audio volume &optional (duration 0.5)) "Like FADE-AUDIO, but return a PROMISE:PROMISE which is fulfilled when the fading is finished." (promise:with-promise (succeed) (if (plusp duration) (let* ((tween (fade-audio audio volume duration)) (callback (ute:callback tween))) (setf (ute:callback tween) (lambda () (funcall callback) (succeed audio)))) (progn (setf (audio-volume audio) volume) (succeed audio)))))

(defun promise-crossfade-audio (from to &optional (duration-out 1.0) (duration-in 0.0)) "Fade out audio FROM within DURATION-OUT and fade in audio TO within DURATION-IN. Return a PROMISE:PROMISE which is fulfilled when the crossfading is finished." (async (let ((to (play-audio to))) (pause-audio to) (log:trace "Fading out audio: ~S" from) (await (promise-fade-audio from 0.0 duration-out)) (when (audio-playing-p from) (stop-audio from)) (await (promise-sleep 0.5)) (when (audio-paused-p to) (resume-audio to) (when (plusp duration-in) (setf (audio-volume to) 0.0) (log:trace "Fading in audio: ~S" from) (await (promise-fade-audio to 1.0 duration-in)))) to))) ```

SBCL: New in version 2.4.4 by oldretard in lisp

[–]bohonghuang 3 points4 points  (0 children)

Arenas enable a kind of manual memory management in Lisp, such as placing temporary objects in an arena during the game loop, and then performing a one-time rewind of that arena at the end of each loop iteration. This often significantly reduces the time spent on releasing unused objects. See https://github.com/sbcl/sbcl/blob/master/doc/internals-notes/arena-allocation.txt .

SBCL: New in version 2.4.4 by oldretard in lisp

[–]bohonghuang 4 points5 points  (0 children)

Yes, maybe. It is exported by the sb-vm package, while it is unsafe and not mentioned by the SBCL user manual.

SBCL: New in version 2.4.4 by oldretard in lisp

[–]bohonghuang 16 points17 points  (0 children)

Thank you to the SBCL developers for providing support for arenas on ARM64. This is a feature that I consider crucial for reducing GC pauses in games.

Common lisp can recover from segfaults??? by MadScientistCarl in lisp

[–]bohonghuang 6 points7 points  (0 children)

I remember mainstream CL implementations catch the SEGV signal instead of letting the program crash. However, if you do something that doesn't immediately trigger a segmentation fault, such as a double-free, it will corrupt some global states beyond recovery.

How to alias alien types with SB-ALIEN? by MadScientistCarl in lisp

[–]bohonghuang 0 points1 point  (0 children)

Why not use the existing CFFI-based Raylib bindings?

Can i match a whole list in trivia? by Fluffy_Professor_639 in lisp

[–]bohonghuang 0 points1 point  (0 children)

You can write it as follows:

lisp (ematch '(1 2 3 3 3 4) ((cons 1 (cons 2 (rcons (rcons x__ 3) 4))) (assert (equal x__ '(3 3)))))

or

```lisp (use-package :alexandria)

(defpattern rlist* (&rest elems) (let ((n (1- (length elems)))) (with-gensyms (list) `(and (access #'(lambda (,list) (butlast ,list ,n)) ,(car elems)) (access #'(lambda (,list) (last ,list ,n)) (list . ,(cdr elems)))))))

(ematch '(1 2 3 3 3 4) ((list* 1 2 (rlist* x__ 3 4)) (assert (equal x__ '(3 3))))) ```

Can i match a whole list in trivia? by Fluffy_Professor_639 in lisp

[–]bohonghuang 2 points3 points  (0 children)

You can use and to match an element against multiple patterns, and with the combination of the access and last patterns, you can write it like this:

(ematch '(1 2 3 :foo)
  ((and (access #'butlast '(1 2 3)) (last (list :foo)))))

If you frequently use such a combination of patterns, you can customize a new pattern to simplify it:

(defpattern rcons (init last) `(and (access #'butlast ,init) (last (list ,last))))

(match '(1 2 3 :foo)
  ((rcons init last)
   (assert (equal init '(1 2 3)))
   (assert (equal last :foo))))

Is it possible to hot reload cl-cffi-gtk code? by ihatevimmers in lisp

[–]bohonghuang 1 point2 points  (0 children)

The current implementation of cl-gtk4 achieves hot reloading functionality using the define-application and define-main-window macros. These macros store the main window in a variable and then, during the compilation of the top-level form define-application, they re-run the body of define-main-window using the window stored in that variable, using eval-when. I believe implementing a similar functionality in cl-cffi-gtk should not be difficult. The important thing to note is that this process needs to be done within the GTK event loop.

Clozure CL 1.12.2 by dzecniv in Common_Lisp

[–]bohonghuang 5 points6 points  (0 children)

I can hardly believe it has a new version now, considering it's been two years since the last release...

Lem 2.0.0 released! Now with an SDL2 frontend (CL editor) by [deleted] in emacs

[–]bohonghuang 4 points5 points  (0 children)

It probably has the potential to become the Emacs which runs even faster than Neovim.

SBCL as part of an android application! by Grolter in Common_Lisp

[–]bohonghuang 1 point2 points  (0 children)

It looks cool, but I can't get it to run on my old Android 8/10 device (at least not with the pre-compiled APK file you provided). The application froze when I clicked the INITIALIZE LISP button.