sa_nyc
sa_nyc

Reputation: 981

Compose function in smlnj

I have to write a function compose which accepts a list of unary functions f1,...,fn and a value v as arguments and computes f1(f2(. . . (fn(v)) . . .))... in SMLNJ

i am trying to make a curried version of it w/o using built in curry implementation, any suggestions?

how to implement it with own curry technique?

Upvotes: 1

Views: 407

Answers (1)

Andreas Rossberg
Andreas Rossberg

Reputation: 36118

When you use ::, remove the square brackets around the pattern. Otherwise you match a 1-element list whose element is another nested list.

Also, the second case in your definition seems redundant.

Upvotes: 1

Related Questions