evyatar2013
2020-6-3 15:39:19

I know I saw this in the docs, but I cant recall its in.

What is the function that takes in three procedures and applies them in order (i.e (first) (second) (third)) but returns the value of the second?


soegaard2
2020-6-3 15:41:02

I think you need to define it yourself.


soegaard2
2020-6-3 15:41:34

(define (name f g h) (f) (begin0 (g) (h)))


soegaard2
2020-6-3 15:42:12

Here begin0 used to to return the value of (g) rather than (h).


evyatar2013
2020-6-3 15:42:55

ah! that’s much cleaner than my working implementation: (define (name f g h) (f) (define foo (g)) (h) foo)


soegaard2
2020-6-3 15:43:37

works exactly he same


michaelmmacleod
2020-6-3 16:39:31

@evyatar2013 I think you want dynamic-wind


evyatar2013
2020-6-3 16:39:50

Yup! That was it!


samdphillips
2020-6-3 17:41:55

dynamic-wind does a bit more than just running the procedures in sequence though.