Better types #15

Merged
alex-eg merged 27 commits from better-types into main 2025-10-30 16:05:44 +01:00
alex-eg commented 2025-10-21 21:00:11 +02:00 (Migrated from github.com)
No description provided.
pkulev (Migrated from github.com) requested changes 2025-10-29 14:57:12 +01:00
@@ -126,18 +126,17 @@ return Sex code.
(puts ,message)
pkulev (Migrated from github.com) commented 2025-10-25 14:30:24 +02:00

Missing bracket one closing there is, senses of mine telling me, young Sexwalker.

Missing bracket one closing there is, senses of mine telling me, young Sexwalker.
pkulev (Migrated from github.com) commented 2025-10-25 15:12:16 +02:00
(pub fn init () int

And that doesn't look as valid C.

```suggestion (pub fn init () int ``` And that doesn't look as valid C.
@@ -48,0 +50,4 @@
(if (and (list? type)
(= 1 (length type)))
(car type)
type))
pkulev (Migrated from github.com) commented 2025-10-28 17:50:25 +01:00

Looks like this code can be extracted into a function with a slight readability boost (if named properly).

Something like this:

(define (squeeze-typleton type-list)
  (if (and (list? (car type-list))
    ...
Looks like this code can be extracted into a function with a slight readability boost (if named properly). Something like this: ```scheme (define (squeeze-typleton type-list) (if (and (list? (car type-list)) ... ```
pkulev (Migrated from github.com) commented 2025-10-28 17:52:13 +01:00

And here we can reuse it

         `(%array ,(walk-type (squeeze-typleton array-type)))
And here we can reuse it ```suggestion `(%array ,(walk-type (squeeze-typleton array-type))) ```
pkulev (Migrated from github.com) commented 2025-10-28 17:59:15 +01:00

That function is a little complex, would be nice to have unit tests for it.

Also could fold-right be replaced with flatten?

  (if (atom? type) (atom-to-fmt-c type)
      (flatten
       (tree-map atom-to-fmt-c
                 (flatten
                             (list-join (reverse (list-split type '*))
                                        '(*)))))))

Gosh it's fucking torture to write and edit lisp snippets on github.

That function is a little complex, would be nice to have unit tests for it. Also could fold-right be replaced with flatten? ```suggestion (if (atom? type) (atom-to-fmt-c type) (flatten (tree-map atom-to-fmt-c (flatten (list-join (reverse (list-split type '*)) '(*))))))) ``` Gosh it's fucking torture to write and edit lisp snippets on github.
pkulev (Migrated from github.com) commented 2025-10-28 18:01:39 +01:00
;;; TODO: isn't there a better way?
```suggestion ;;; TODO: isn't there a better way? ```
pkulev (Migrated from github.com) commented 2025-10-29 14:53:09 +01:00

Oh! That's similar

          ((var . type) (append (list (walk-type (squeeze-typleton-or-maybe-better-name-huh type))...
Oh! That's similar ```suggestion ((var . type) (append (list (walk-type (squeeze-typleton-or-maybe-better-name-huh type))... ```
alex-eg (Migrated from github.com) reviewed 2025-10-30 00:06:55 +01:00
@@ -126,18 +126,17 @@ return Sex code.
(puts ,message)
alex-eg (Migrated from github.com) commented 2025-10-30 00:06:55 +01:00

😱

😱
alex-eg (Migrated from github.com) reviewed 2025-10-30 00:07:15 +01:00
@@ -126,18 +126,17 @@ return Sex code.
(puts ,message)
alex-eg (Migrated from github.com) commented 2025-10-30 00:07:15 +01:00

😱

😱
alex-eg (Migrated from github.com) reviewed 2025-10-30 00:08:19 +01:00
@@ -48,0 +50,4 @@
(if (and (list? type)
(= 1 (length type)))
(car type)
type))
alex-eg (Migrated from github.com) commented 2025-10-30 00:08:18 +01:00

Yes. Qualifies as self-harm.

Yes. Qualifies as self-harm.
alex-eg (Migrated from github.com) reviewed 2025-10-30 00:08:30 +01:00
@@ -48,0 +50,4 @@
(if (and (list? type)
(= 1 (length type)))
(car type)
type))
alex-eg (Migrated from github.com) commented 2025-10-30 00:08:30 +01:00

🤯

🤯
alex-eg (Migrated from github.com) reviewed 2025-10-30 00:08:47 +01:00
@@ -48,0 +50,4 @@
(if (and (list? type)
(= 1 (length type)))
(car type)
type))
alex-eg (Migrated from github.com) commented 2025-10-30 00:08:47 +01:00

🤯

🤯
alex-eg (Migrated from github.com) reviewed 2025-10-30 08:58:59 +01:00
@@ -126,18 +126,17 @@ return Sex code.
(puts ,message)
alex-eg (Migrated from github.com) commented 2025-10-30 08:58:59 +01:00

🤯

🤯
alex-eg (Migrated from github.com) reviewed 2025-10-30 09:52:56 +01:00
@@ -48,0 +50,4 @@
(if (and (list? type)
(= 1 (length type)))
(car type)
type))
alex-eg (Migrated from github.com) commented 2025-10-30 09:52:56 +01:00

Also could fold-right be replaced with flatten?

In general, it could not:

(fold-right append (list) '(((1 2)) (3 4) (5 6)))
; ((1 2) 3 4 5 6)

However, here we can, I think. There shouldn't be any meaningful nesting in cv* type chains.

That function is a little complex, would be nice to have unit tests for it.

It's implicitly tested via all walk-type tests. However, I agree that it would be nice to have some test specifically for this function.

>Also could fold-right be replaced with flatten? In general, it could not: ``` (fold-right append (list) '(((1 2)) (3 4) (5 6))) ; ((1 2) 3 4 5 6) ``` However, here we can, I think. There shouldn't be any meaningful nesting in `cv*` type chains. > That function is a little complex, would be nice to have unit tests for it. It's implicitly tested via all `walk-type` tests. However, I agree that it would be nice to have some test specifically for this function.
pkulev (Migrated from github.com) requested changes 2025-10-30 13:54:59 +01:00
pkulev (Migrated from github.com) commented 2025-10-30 13:54:52 +01:00

Good stuff, good stuff. But there's a smol momentik left :eye:👁️

Good stuff, good stuff. But there's a smol momentik left :eye::eye:
alex-eg (Migrated from github.com) reviewed 2025-10-30 13:57:15 +01:00
alex-eg (Migrated from github.com) commented 2025-10-30 13:57:15 +01:00

What of it?

What of it?
alex-eg (Migrated from github.com) reviewed 2025-10-30 14:02:03 +01:00
@@ -126,18 +126,17 @@ return Sex code.
(puts ,message)
alex-eg (Migrated from github.com) commented 2025-10-30 14:02:02 +01:00

There was not. You bamboozled me!
Screenshot 2025-10-30 at 16 01 22

There was _not_. You bamboozled me! <img width="343" height="94" alt="Screenshot 2025-10-30 at 16 01 22" src="https://github.com/user-attachments/assets/617c4c30-0462-40f8-9672-e2c23b51953c" />
alex-eg (Migrated from github.com) reviewed 2025-10-30 14:03:40 +01:00
alex-eg (Migrated from github.com) commented 2025-10-30 14:03:40 +01:00

Looks just right idk.
Screenshot 2025-10-30 at 16 03 25

Looks just right idk. <img width="463" height="325" alt="Screenshot 2025-10-30 at 16 03 25" src="https://github.com/user-attachments/assets/3dddf160-8ce0-42cb-b15f-77d4e6ec718f" />
alex-eg (Migrated from github.com) reviewed 2025-10-30 14:05:08 +01:00
alex-eg (Migrated from github.com) commented 2025-10-30 14:05:08 +01:00

Ah shit, I see now. 👁️ 👄 👁️

Ah shit, I see now. 👁️ 👄 👁️
pkulev (Migrated from github.com) reviewed 2025-10-30 15:15:54 +01:00
@@ -126,18 +126,17 @@ return Sex code.
(puts ,message)
pkulev (Migrated from github.com) commented 2025-10-30 15:15:53 +01:00

Why paren mathing is fucked up I guess, silly komputer haha

Seriously, look here mate
image

Why paren mathing is fucked up I guess, silly komputer haha Seriously, look here mate <img width="970" height="546" alt="image" src="https://github.com/user-attachments/assets/1738f71d-8357-47a7-b4eb-012400379d6f" />
alex-eg (Migrated from github.com) reviewed 2025-10-30 15:49:32 +01:00
@@ -126,18 +126,17 @@ return Sex code.
(puts ,message)
alex-eg (Migrated from github.com) commented 2025-10-30 15:49:32 +01:00

🤤

:drooling_face:
pkulev (Migrated from github.com) approved these changes 2025-10-30 15:58:04 +01:00
Sign in to join this conversation.