Shorter:
(define (find proc list)
(cond
((null? list) #f)
((proc (car list)) (car list))
(else (find proc (cdr list)))))
Max
On 5. Jun 2019, at 11:03, Frank <address@hidden> wrote:
Hello,
I believe that implementing find procedure by hand is a better option.
(define (find proc list)The filter procedure costs asymptotically more time on average (and probably
(define (find-iter head)
(cond
((null? head) #f)
((proc (car head)) (car head))
(else (find-iter (cdr head)))))
(find-iter list))
more space, depending on the implementation).
Best wishes,
Le 04/06/2019 à 23:19, Giovanni Piredda a écrit :
I need to become acquainted with the different standards :-) (I checked Guile--
without realizing that I was checking a different version).
I used the filter function in place of it.
G.
On 04.06.19 23:06, Massimiliano Gubinelli wrote:
You expect the procedure find to be defined in Guile? I just checked and even
from the REPL on the command line such function does not belong to Guile 1.8.
Not all schemes implement the same language. In particular you cannot expect
procedures which are not requested by the R5RS standard since Guile 1.8 is
essentially based on that.
Best
Max
On 4. Jun 2019, at 22:19, Giovanni Piredda <address@hidden> wrote:
On 04.06.19 22:18, Giovanni Piredda wrote:
Dear all,I mean the same code which is giving an error inside TeXmacs
did anyone ever used the find function in the Scheme implementation used in TeXmacs? It
gives me a "Unbound variable: find" error. I can run the same code from emacs
(using MIT-GNu Scheme).
Best wishes!
Yours,
Archive powered by MHonArc 2.6.19.