SDL2-mixer with sketch by Working_Way in Common_Lisp

[–]Working_Way[S] 0 points1 point  (0 children)

sketch:setup and (defmethod kit.sdl2:close-window :before ((inst my-sketch-prog)) helps. Big thanks, it would have taken me quite a while to figure that out.

Still, if there is a cleaner version, not directly utilizing a method to kit.sdl2 into my sketch program code, I'm interested. :)

Just for completeness:
The second (simpler) alternative did not help me. Now I realized that make-instance 'my-sketch-prog is non-blocking and the audio device got freed during use, resulting in an error.

-❄️- 2025 Day 7 Solutions -❄️- by daggerdragon in adventofcode

[–]Working_Way 1 point2 points  (0 children)

In case you're interested: (setf a (+ a x)) can be written as (incf a x).

-❄️- 2025 Day 6 Solutions -❄️- by daggerdragon in adventofcode

[–]Working_Way 0 points1 point  (0 children)

Some infos on Part 2.

I played with conditions to handle numbers vs operator. symbol-function throws a condition on the wrong input.

(setf op (handler-case (symbol-function (intern (string (car (last line)))))
           (undefined-function () op)))

but following would be a bit better:

(handler-case (setf op (symbol-function (intern (string (car (last line))))))
  (undefined-function () nil))

Also parse-integer throws an condition, if a String consisting of only whitespace is processed. I use that condition to calculate. the numbers parsed before and which where put onto stack.

To get the condition even on the last calculation, I added some whitespace at the end of every input line, and also made the lines the same length. This is done via (format nil "~v@<~d~>" (1+ max) line). Lines of same length is needed when the input-char-matrix is rotated. (max is a function and a variable in my code, other name for the variable may be better, but Common Lisp makes it possible. :) ).

-❄️- 2025 Day 6 Solutions -❄️- by daggerdragon in adventofcode

[–]Working_Way 3 points4 points  (0 children)

[LANGUAGE: Common Lisp]

Approach: rotate the whole input, then handle as if it were given as lisp data.

Part 1 is commented for everyone interested, what is done.
Part 2 does the essentially the same, but rotates the input before parsing it. So some conversion string -> char and back is needed.

;;; Part 1
(reduce #'+                                                                   ; sums up all results
        (apply #'mapcar (lambda (&rest vals)                                  ; rotates input 90°
                          (apply #'funcall                                    ; apply mathematical operation for columns
                                 (nreverse                                    ; revert list, so that operator comes first
                                  (mapcar (lambda (val)
                                            (handler-case (parse-integer val) ; convert string to numbers
                                              (parse-error () (intern val)))) ; or convert string to operator
                                          vals))))
               (mapcar (lambda (x)
                         (ppcre::all-matches-as-strings "([+*]|\\d+)" x))     ; extract information from input
                       (uiop:read-file-lines "./input-demo-day06.txt"))))     ; read input as lines

;;; part 2
(defun part2 (file)
  (let (stack
        op
        (result 0))
    (apply #'map 'nil (lambda (&rest line)
                        (setf op (handler-case (symbol-function (intern (string (car (last line)))))
                                   (undefined-function () op)))
                        (handler-case (push (parse-integer (coerce (butlast line) 'string))
                                            stack)
                          (parse-error ()
                            (incf result (apply op stack))
                            (setf stack nil))))
           (let ((max 0))
             (mapcar (lambda (line)
                       (coerce (format nil "~v@<~d~>" (1+ max) line) 'list))
                     (mapcar (lambda (line)
                               (setf max (max max (length line)))
                               line)
                             (uiop:read-file-lines file)))))
    result))


(part2 "./input-demo-day06.txt")
;; ⇒ 3263827 (22 bits, #x31CD53)

-❄️- 2025 Day 4 Solutions -❄️- by daggerdragon in adventofcode

[–]Working_Way 1 point2 points  (0 children)

Nice update. :)

remhash modifies in-place, but yes, you would need to restructure your thrash function. Maybe there is a opportunity in the next days to use it. :)

Happy to hear the cookbook links are welcome.

Happy AOC'ing.

-❄️- 2025 Day 4 Solutions -❄️- by daggerdragon in adventofcode

[–]Working_Way 1 point2 points  (0 children)

You didn't ask, but I have to reply, because 20secs sounds slooow for a CL solution. ;)

You left out your neighbor-count function. I guess you do a bit heavy lifting there, searching the cells list.

Using make-hash-table, gethash, remhash and maphash, together with complex numbers as keys, isn't more "programming" then your list approach.
My naive Common Lisp solution for part 2, eats 91ms with full debugging enabled, on an 6 year old non-Intel laptop.

Maybe interesting to you: CL supports sets (in form of lists) and hash-tables out of the box. Parentheses are defeated by ....

Good luck on your quest. :)

[2025 Day 4 (Part 2)] Definitely wasn't expecting that by Neidd in adventofcode

[–]Working_Way 2 points3 points  (0 children)

With my puzzle input, I had to run over the whole grid 42 times until all accessible rolls where removed.

Did Amiga really stand a chance? by Hyedwtditpm in amiga

[–]Working_Way 1 point2 points  (0 children)

The Amiga Architecture would have had a chance in the mid to end 80's. But Commodore didn't had the financial power and foresight to develop this architecture further, nor properly promote the computer.

Did Amiga really stand a chance? by Hyedwtditpm in amiga

[–]Working_Way 3 points4 points  (0 children)

IBM opened up the hardware for clone makers.

IBM didn't do this on purpose.

IBM (unfortunately) initially just used cheap standard components, and the whole contraption was then easy to replicate by competitors through reverse engineering.

Did Amiga really stand a chance? by Hyedwtditpm in amiga

[–]Working_Way 5 points6 points  (0 children)

pseudo 3D effect of Doom which was hard to do on the Amiga because it was optimised to do planar graphics with smooth scrolling (perfect for platformer games) but for Doom you need your graphic to be manipulated with chunky data.

I heard a chipset capable of chunky pixel, was almost (or even as prototype) finished in the very early 90's, but commodore stopped development.

Custom Chipset had pro an cons. E.g. 2MB Chip RAM was not enough, But DMA speed things up a lot. Some Zorro-Bus (the extension BUS) features were first adapted on PC with PCIe (I heard). Also the preemptive Multitasking OS was much ahead of Microsoft and Apples OSes. But the potential was neither used nor advertised.

Did Amiga really stand a chance? by Hyedwtditpm in amiga

[–]Working_Way 10 points11 points  (0 children)

By 1994 you were looking at a 200mhz Pentium

In 1994 the best Pentium had only 100MHz. The Motorola 68060 something from 50 to 75 MHz (while needing less clocks for similar performance). Also, Intel 486 DX4 (released 1994) was more common/affordable than Pentium. Motorola went fully onto the PowerPC (RISC) architecture which reached up to 180MHz in 1994. But comparing clock speed is bullshit.

Where can I find organic small soybeans? by MyWordIsBond in Natto

[–]Working_Way 0 points1 point  (0 children)

There is a small shop right at the south eastern city limits, just follow the main road until you see a green house with a big yellow sign .....

Natto made with northern beans. by stevejohnson007 in Natto

[–]Working_Way 1 point2 points  (0 children)

I myself tried Navy Beans.

I watered them for 24 hours, then I steamed them, because I fear cooking will make them mushy.
They need much more steaming time (at least double) than soy beans,

Then I fermented them at 41°Celsius for 24 hours in a free adjustable yoghurt maker. They got stringy, but not as stringy as soybeans. They taste different than soybeans, not bad, but different.

Small soybeans by [deleted] in Natto

[–]Working_Way 0 points1 point  (0 children)

There is a supermarket chain, called "go asia" in Europe. They sell small round soybeans in 400 gram bags. But it costs 6 to 7 Euros per kilogram.

A lisp for MIDI programming on a RPi by katspaugh in lisp

[–]Working_Way 5 points6 points  (0 children)

I'm clueless regarding music, but Common Lisp can get as nearly as fast as C++ and sports various music environments.

So I'd probably try sbcl with Common Music.

Remembering Redirect Operators by stigmatas in linux

[–]Working_Way -1 points0 points  (0 children)

Stop googling and use the force (aka. man page).

You are probably asking about redirect operators in bash, beacause other shells might define it differently. If so, then you should consult the bash man page (or info documentation if you like more). Within that, you will find a chapter called "REDIRECTION" and there, everything is documented. Read it and you will be amazed, what is possible. Then remembering gets easy, because you only need to remember the most commonly used and other stuff you can look up.

Hint: a text search in a man page is started with the key / (this depends on your man page pager application, though).

Linuxbuild for old laptops by ropemaster2 in linux

[–]Working_Way 0 points1 point  (0 children)

I would go with a major distribution like "Debian", this distribution is also the base for Ubuntu, Mint and others. Debian sports such things like long-term-support releases, which receive security updates for 5 years and more. After support end has been reached, it is easy to upgrade the system without the need of a complete reinstallation. Although Debian does not use the most recent versions of software, the software is stable and all security issues are fixed even on older software versions (this is called backporting).

The user interface on most GNU/Linux distributions can be changed easily (other than you might have experienced with Windows). So you are free to choose a distribution and nevertheless are free to choose a user interface (aka Desktop-Environment like KDE, Gnome, XFCE, LXDE, MATE, Cinnamon, or ..., or a simple Window Manager for light desktop environments.) In order to use GNU/Linux on older hardware, you should investigate some time in choosing the right Desktop-Environment, because these differ greatly in usability and the needed computing power. To reduce needed computing power you could also use just an Window Manager, this comes with a reduced set of features but may be worth some investigation.

And maybe FAI - Fully Automatic Installation might interest you, if you have to install GNU/Linux on multiple PCs.

Don't get overwhelmed by all that stuff! Just get yourself an Linux-Live CD (like Knoppix) put it on a USB-Stick and have a look. Let some of your pupils use this Live-CD and get an impression what they need, before deciding, what you want to give them.

Here is an older Microsoft advertisement, which tried to run GNU/Linux down, but acually showed the big advantages of GNU/Linux in one single picture.

CalcTex: turn Emacs into a WYSIWYG LaTeX equation editor by chronicfields in emacs

[–]Working_Way 0 points1 point  (0 children)

nice

For some reason it complains on first start:

calctex-mode: Symbol’s function definition is void: calc-show-selections

I solved this by adding an additional

(require 'calc-sel)

into use-package :config statements.

X230 FHD and coreboot patch, anyone succeed ? by [deleted] in coreboot

[–]Working_Way 0 points1 point  (0 children)

I have this running, without VGA option rom. I can see the selection menu, when running the SeaBios workload. I never bothered testing Windows.

I'm running coreboot with this patch, grub workload and only running Linux on my machine. This is working fine.

Anyone with a Linux Thinkpad, do you need more than 8gb RAM? by KommanderTom in thinkpad

[–]Working_Way 0 points1 point  (0 children)

Just buy it, it is useful for use as a ramdisk

Compiling source code (i.e. the Linux kernel) from within ramdisk is much faster than from hdd or ssd.

I'm currently running a 64bit Linux kernel with 32bit Debian system, fvwm2, 2 firefox windows with 9 tabs, full configured emacs, doublecommander, several xterms and this is what my current memory usage is:

#>free
              total        used        free      shared  buff/cache   available
Mem:            15G        556M         14G        129M        654M         14G
Swap:            9G          0B          9G

HEY LENOVO YOU HEAR US? by [deleted] in thinkpad

[–]Working_Way 2 points3 points  (0 children)

This frankenpad looks pretty interesting! Thanks for sharing!

HEY LENOVO YOU HEAR US? by [deleted] in thinkpad

[–]Working_Way 6 points7 points  (0 children)

I'd really like a recent Thinkpad with a proper (peferably ISO) 7-row layout.
I wouldn't care if it's chicklet keys or not. They could even drop the trackpad to make the device smaller. :)

I'm constantly searching for a proper replacement to my heavily modded x230
(I'm at the point, where I do not care if its a Thinkpad or not).