Ludovic Courtès on Nostr: ;; OCaml example translated to Scheme. (use-modules (ice-9 match) (srfi srfi-71)) ...
;; OCaml example translated to Scheme.
(use-modules (ice-9 match) (srfi srfi-71))
(define (self-convolution lst)
(define (visit suffix)
(match suffix
(()
(values lst '()))
((head . tail)
(let ((input output (visit tail)))
(values (cdr input)
(cons (cons head (car input))
output))))))
(let ((_ lst (visit lst)))
lst))
Published at
2024-04-14 20:42:51Event JSON
{
"id": "3d0479119005227044762f5d0bdcd9f73b990d76edd8912f552859c5ba9d152d",
"pubkey": "a2f3c64c54a02b513cdf0462dbbd46f37b07ab9e2b4c1edf49df645c511e7cdd",
"created_at": 1713127371,
"kind": 1,
"tags": [
[
"e",
"cd7d7bd458cdcb2263616137e90a81bfb9f636cf98039cfe31d7138e79287efb",
"wss://relay.mostr.pub",
"reply"
],
[
"proxy",
"https://toot.aquilenet.fr/users/civodul/statuses/112271515441506579",
"activitypub"
]
],
"content": ";; OCaml example translated to Scheme.\n(use-modules (ice-9 match) (srfi srfi-71))\n\n(define (self-convolution lst)\n (define (visit suffix)\n (match suffix\n (()\n (values lst '()))\n ((head . tail)\n (let ((input output (visit tail)))\n (values (cdr input)\n (cons (cons head (car input))\n output))))))\n\n (let ((_ lst (visit lst)))\n lst))",
"sig": "0c2e223197f72ff538a6407cd92880b3e5cee6f37b30d7ccd0929ad88a78b50af8f6e2ea9eecdde98e13b31a4659aa583a212d96001b996284852747fa178a76"
}