Ann: func pack updates
Michael Hendricks <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <CAFHuXua+_tMVMqLUqkHD7UQr=YdMXn1DDeaPGdDE_4ACFfk6vw@mail.gmail.com> |
In v0.3.0 the func pack supports functions similar to Carlo's lifter module. For example, ?- length(L, ~ is 1+2). L = [_G185, _G188, _G191]. SWI-Prolog 7 dicts are now treated as functions too. This lets you use `Dict $ key` to lookup a key's value. Unlike V7's dot notation, looking up a missing key fails instead of throwing an exception. Because dicts are functions like everything else, you can compose dictionaries together with other functions to produce still more functions. I'm not sure how practical this feature will be, but it took no extra code and makes me smile :-) -- Michael -------------- next part -------------- HTML attachment scrubbed and removed