28 ms·
I thought Little Learner assumed you already knew Lisp/scheme. You'd probably want to go through at LEAST Little Schemer from same author first to get the basic
by runevault 4y ago
I thought Little Learner assumed you already knew Lisp/scheme. You'd probably want to go through at LEAST Little Schemer from same author first to get the basics.
- taeric 4y agoThe first chapter goes over everything you'd need to know of scheme to get running. And it has its own choices in how they are using scheme. In particular, they curry all of the functions, it looks. My understanding is that this is on purpose for things they do later in the book. Which shows I have not finished it, yet. :D I am finding it fun, already.
- runevault 4y agoHuh interesting. And I've never seen someone make curryable functions in lisp, though I'm not surprised you can lol.
- taeric 4y agoFor machine learning, it makes a lot of sense. Effectively, training is a function that returns a function, after all.
- runevault 4y agoOh yeah not disagreeing with that, just interesting because I'd never seen anyone rig up curried functions in scheme/lisp before as it obviously isn't default behavior in a traditional lisp. I'm assuming using some sort of wrapper function or macro.
- taeric 4y agohttps://mitpress.ublish.com/ebook/the-little-learner-a-straight-line-to-deep-learning-preview/12735/C1 https://mitpress.ublish.com/ebook/the-little-learner-a-strai... has the first two chapters. The forward plants the seed for the fact that it will be currying. When the chapters start, they don't use the term and just show functions returning functions. Immediately.
- kazinator 4y agoThe examples look like normal Scheme to me. There is nothing odd going on with custom macros. They have broken some argument lists into currying, that's all. (define line (lambda (x) (lambda (w b) (+ (* w x) b)))) Firstly, it's not full currying; the w and b parameters are not separated from each other into different lambdas. These kinds of nested lambdas are not unheard of in Lisp and Scheme programming. Lisps do not have automatic partial application. If you have a (f x y z) function, you cannot just call it (f 42) to partially apply it, to obtain a function which takes the y and z arguments. You have to do a clumsy thing with an explicit lambda like this: (lambda (y z) (f 42 y z)). There are macros for that, which can make it look like (op f 42) or what have you. If you need partial application regularly over some functions, it may behave you to write the function in the curried style. Passing all the parameters becomes a bit less convenient: ((line 1) 2 3) ;; versus just (line 1 2 3) but the partial application you want is a lot less verbose: (line 1) ;; versus (lambda (w b) (line 1 w b)). So basically it looks like the authors may be after low-verbosity partial application without macro assistance.
- runevault 4y agoAh ha, yeah having a pre set one or two step currying setup is a lot easier sure. Just return a lambda that captures the value passed in from the first one.