Remove curry function

This commit is contained in:
Nikolay Puzanov 2022-11-28 16:14:52 +03:00
parent 7f17725012
commit c3fd80de71

View File

@ -3,11 +3,11 @@
(define-module (embddr common))
(import (srfi srfi-1)
(srfi srfi-26)
(srfi srfi-60))
(export log2 clog2 round-to
one? power-of-two?
curry curry-r
transpose
number->string-binary
number->string-binary-slice
@ -42,16 +42,6 @@
(let ((k (expt 10 n)))
(/ (round (* num k)) k)))
;;; Currying
;;; Example: ((curry-r f 1) 2 3) -> (f 1 2 3)
(define (curry f . args)
(lambda x (apply f (append args x))))
;;; Currying right
;;; Example: ((curry-r f 1) 2 3) -> (f 2 3 1)
(define (curry-r f . args)
(lambda x (apply f (append x args))))
;;; Transpose of matrix (list of lists)
(define (transpose m)
(apply map (cons list m)))
@ -150,7 +140,7 @@
(addrs (sort addrs >)))
(map
(lambda (addr)
(let ((others (remove (curry = addr) addrs))
(let ((others (remove (cut = addr <>) addrs))
(abits (number->bits addr bit-width)))
(cons
addr