mailing-list for TeXmacs Users

Text archives Help


Re: [TeXmacs] Scheme in TeXmacs: is the find function supported?


Chronological Thread 
  • From: Giovanni Piredda <address@hidden>
  • To: address@hidden
  • Subject: Re: [TeXmacs] Scheme in TeXmacs: is the find function supported?
  • Date: Wed, 5 Jun 2019 09:36:30 +0200

Thanks to both.


Right now I am searching for an element in a list of a few, so different implementations make unappreciable differences, but it is nice to have an efficient implementation.


Giovanni


Am 05.06.2019 um 11:20 schrieb Massimiliano Gubinelli:
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)
(define (find-iter head)
(cond
((null? head) #f)
((proc (car head)) (car head))
(else (find-iter (cdr head)))))
(find-iter list))
The filter procedure costs asymptotically more time on average (and probably
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,

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).


I mean the same code which is giving an error inside TeXmacs

--
Best wishes!
Yours,





Archive powered by MHonArc 2.6.19.

Top of page