In the forgotten theory /fold/ should reduce its arguments like in the following examples:

(define (apply-or well-formed-list)
  (foldl {lambda (a b) (or a b)}
         #f
         well-formed-list))
(define (apply-and well-formed-list)
  (foldl {lambda (a b) (and a b)}
         #t
         well-formed-list))

These aren't intelligent quantors but you'll see what their good for.

I don't know why people try to find out about the inner workings of some implementation of an abstract operation by using it for things it wasn't meant for. Perhaps it's bad examples in some documentation. Perhaps my mind has just passed to much time in some other interpreter. ;-)

On 29/07/2015 16:46, sagyo12341...@gmail.com wrote:
You are right.

; proc, init and lst are from the racket reference.

(define (my-foldl proc init lst)
   (define (rec res rest1)
     (if (null? rest1)
         res
         (rec (proc res (first rest1)) (rest rest1))))
   (rec init lst))

(my-foldl (lambda (x y) (list x y)) '() '(a1 a2 a3 a4 a5))
'(((((() a1) a2) a3) a4) a5)


--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to