Re: [stack] What does "concatenative" actually mean?
Robbert Dalen <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
> In Joy, neither holds. A function like 'rand' is going to return > different values given the same input. The only way to prevent this is > to pass a world value through the program and have 'rand' require > exclusive access to that world value in order to determine its output. > The only way to do this sensibly (i.e. in a way that would permit > arbitrary order reduction) is with a type system. > but rand is not pure. i'm talking about joy with only pure functions. you can create randomness purely. for instance, you can take the sha1 hash of any value to create a random number. this random number can again and again be hashed, for instance to create a random walk. > > > and joy could be lazy > > No it couldn't. Take the following example where 'print' takes a stack > with a string on top and prints it to the screen: > > "foo" print "bar" print (initial state) > "bar" print (eval '"foo" print') > (eval '"bar" print') > again, print is not pure. i do think that you are right that you can run into problems if you make (the possibly evaluation) of an expression *observable*. this is only problematic with 'open' joy quotations, for instance: [1 2 +] first 1 is different from: [3] first 3 however, this problem could be solved if first was be defined as: - to first evaluate the quotation to normal form - and then take the first element of normal form - robbert.