Remove curry function
This commit is contained in:
parent
7f17725012
commit
c3fd80de71
@ -3,11 +3,11 @@
|
|||||||
(define-module (embddr common))
|
(define-module (embddr common))
|
||||||
|
|
||||||
(import (srfi srfi-1)
|
(import (srfi srfi-1)
|
||||||
|
(srfi srfi-26)
|
||||||
(srfi srfi-60))
|
(srfi srfi-60))
|
||||||
|
|
||||||
(export log2 clog2 round-to
|
(export log2 clog2 round-to
|
||||||
one? power-of-two?
|
one? power-of-two?
|
||||||
curry curry-r
|
|
||||||
transpose
|
transpose
|
||||||
number->string-binary
|
number->string-binary
|
||||||
number->string-binary-slice
|
number->string-binary-slice
|
||||||
@ -42,16 +42,6 @@
|
|||||||
(let ((k (expt 10 n)))
|
(let ((k (expt 10 n)))
|
||||||
(/ (round (* num k)) k)))
|
(/ (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)
|
;;; Transpose of matrix (list of lists)
|
||||||
(define (transpose m)
|
(define (transpose m)
|
||||||
(apply map (cons list m)))
|
(apply map (cons list m)))
|
||||||
@ -150,7 +140,7 @@
|
|||||||
(addrs (sort addrs >)))
|
(addrs (sort addrs >)))
|
||||||
(map
|
(map
|
||||||
(lambda (addr)
|
(lambda (addr)
|
||||||
(let ((others (remove (curry = addr) addrs))
|
(let ((others (remove (cut = addr <>) addrs))
|
||||||
(abits (number->bits addr bit-width)))
|
(abits (number->bits addr bit-width)))
|
||||||
(cons
|
(cons
|
||||||
addr
|
addr
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user