More std migration #1475

Open
fare wants to merge 25 commits from v0.19-std into v0.19-staging
Owner
No description provided.
fare requested review from vyzo 2026-07-23 01:13:53 +00:00
vyzo left a comment

Definite progress, but some porting notes:

For iterators, implement Iterable in the objects, we don't need the in-blah constructs any more, just pass the object directly.

For ports in std/struct, for consistency we need to camelize names.

For all ports, make sure we have signatures.

Definite progress, but some porting notes: For iterators, implement Iterable in the objects, we don't need the in-blah constructs any more, just pass the object directly. For ports in std/struct, for consistency we need to camelize names. For all ports, make sure we have signatures.
@ -0,0 +5,4 @@
(import :std/error
:std/text/pregexp
:std/encoding/hex
(only-in :std/crypto/digest md5)
Owner

i think it is not guaranteed to exist, let's remove it.
I don't think we should use a hash at all, the old uuid from name and hash is not a good idea, let's just remove it and only leave random uuid.

we can also add deterministic uuid from counter (there is a spec for that), but probably follow up.

i think it is not guaranteed to exist, let's remove it. I don't think we should use a hash at all, the old uuid from name and hash is not a good idea, let's just remove it and only leave random uuid. we can also add deterministic uuid from counter (there is a spec for that), but probably follow up.
fare marked this conversation as resolved
@ -0,0 +112,4 @@
(def (deque->list (dq : deque))
=> :list
(let lp ((n dq.back :- node) (r [] :- :list))
Owner

we need to camelize the name of the struct.

we need to camelize the name of the struct.
fare marked this conversation as resolved
@ -0,0 +178,4 @@
(defstruct lru-cache-iterator (cursor (value :- :procedure))
final: #t)
(implement Iterator lru-cache-iterator
Owner

we should also implement Iterable for the LRU. Let's also camelize names.

we should also implement Iterable for the LRU. Let's also camelize names.
fare marked this conversation as resolved
@ -0,0 +2,4 @@
;;; (C) vyzo at hackzen.org
;;; heap based priority queues
(import :std/error)
(export pqueue make-pqueue pqueue? pqueue-empty? pqueue-size
Owner

camelcase

camelcase
fare marked this conversation as resolved
@ -0,0 +9,4 @@
:std/interface
:std/iter/interface
:std/iter/iterators)
(export rbtree rbtree? make-rbtree
Owner

camlize names.

camlize names.
fare marked this conversation as resolved
@ -0,0 +180,4 @@
(def rbtree-iter-key-e (lambda (k v) k))
(def rbtree-iter-val-e (lambda (k v) v))
(def (in-rbtree (rbt : rbtree))
Owner

just make it iterable, no need for the in-blah's any more.

just make it iterable, no need for the in-blah's any more.
fare marked this conversation as resolved
@ -0,0 +165,4 @@
(defstruct rbtree-iterator (stack (value :- :procedure))
final: #t)
(implement Iterator rbtree-iterator
Owner

implement Iterable as well.

implement Iterable as well.
fare marked this conversation as resolved
[RFC 9112 section 7.1](https://datatracker.ietf.org/doc/html/rfc9112#section-7.1) requires the chunked response body to end with `0\r\n\r\n`. The writer previously emitted only `0\r\n`, which strict clients treated as an incomplete response. Chunked responses now include the final CRLF after the zero-size chunk.

Reviewed-on: #1476
Reviewed-by: vyzo <vyzo@noreply.git.cons.io>
@ -0,0 +36,4 @@
(set! next.prev new)
new)))
(defstruct Deque ((front :- Node)
Owner

let's make it iterable too

let's make it iterable too
fare marked this conversation as resolved
@ -0,0 +11,4 @@
;; the module is statically type checked anyway.
(declare (not safe))
(defstruct PQueue ((e : :vector)
Owner

let's make it iterable too

let's make it iterable too
fare marked this conversation as resolved
@ -0,0 +29,4 @@
RBTree-cmp)
;; rbtree structure
(defstruct RBTree (root (cmp :- :procedure))
Owner

let's implement HashTable on rbtrees.

let's implement HashTable on rbtrees.
fare marked this conversation as resolved
Author
Owner

Addressed issues, pushed changes. Please review again.

Addressed issues, pushed changes. Please review again.
@ -0,0 +13,4 @@
push-back! pop-back! peek-back
deque->list
DequeForwardIterator DequeForwardIterator?
DequeReverseIterator DequeReverseIterator?
Owner

maybe Front and Back?

maybe Front and Back?
@ -0,0 +157,4 @@
(lambda (self)
(Iterator (make-DequeForwardIterator self.front)))))
(def (deque-reverse-iter (dq : Deque))
Owner

in this case let's use the in- convention.

in this case let's use the in- convention.
fare changed title from WIP More std migration to More std migration 2026-07-29 12:47:10 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin v0.19-std:v0.19-std
git switch v0.19-std

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch v0.19-staging
git merge --no-ff v0.19-std
git switch v0.19-std
git rebase v0.19-staging
git switch v0.19-staging
git merge --ff-only v0.19-std
git switch v0.19-std
git rebase v0.19-staging
git switch v0.19-staging
git merge --no-ff v0.19-std
git switch v0.19-staging
git merge --squash v0.19-std
git switch v0.19-staging
git merge --ff-only v0.19-std
git switch v0.19-staging
git merge v0.19-std
git push origin v0.19-staging
Sign in to join this conversation.
No description provided.