* Ann: Qi/Shen syntax for guile
@ 2014-05-22 15:09 Kjetil Matheussen
0 siblings, 0 replies; only message in thread
From: Kjetil Matheussen @ 2014-05-22 15:09 UTC (permalink / raw)
To: guile-user
[-- Attachment #1: Type: text/plain, Size: 540 bytes --]
Hi, here's a small library I just made:
https://github.com/kmatheussen/fedex2
With it, you can write code like this:
(define-match keep
[ ] ____ :> '[]
[A . Rest] Pred :> (cons A (keep Rest Pred)) :where (Pred A)
[_ . Rest] Pred :> (keep Rest Pred))
(define-match quicksort
[] :> '[]
[A . R] :> (append (quicksort (keep R (lambda (B) (>= A B))))
(list A)
(quicksort (keep R (lambda (B) (< A B))))))
(test (quicksort '[6 8 5 9 3 2 2 1 4 7])
'[1 2 2 3 4 5 6 7 8 9])
[-- Attachment #2: Type: text/html, Size: 927 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-05-22 15:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-22 15:09 Ann: Qi/Shen syntax for guile Kjetil Matheussen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).