2

cut macro is defined in SRFI-26.

Using this macro, you can write:

(cut + 3 <>)

which is equivalent to:

(lambda (x) (+ 3 x))

However, when putting <> inside the the child parens, it won't work.

(cut + 3 (* 2 <>))

Chicken Scheme interpreter terminates with the following error when we try to apply it.

Error: bad argument count - received 1 but expected 0: #<procedure (?)>

I wan't it to be equivalent to:

(lambda (x) (+ 3 (* 2 x)))

Is there any syntax sugar that I can shorten the above code in Chicken Scheme?

ymonad
  • 11,710
  • 1
  • 38
  • 49
  • This might be the egg you need? http://wiki.call-cc.org/eggref/4/holes – soegaard Nov 27 '16 at 18:55
  • 1
    @soegaard Thanks! Using the `holes` egg, I can write `##( + 3 (* 2 !!))` . please post it as answer and I will accept it. – ymonad Nov 28 '16 at 01:41

0 Answers0