4 ms·
Looking for Tu
- martyalain 2y ago[flagged]
- deleted 2y ago[deleted]
- tromp 2y ago> we have added the SWAP function available on demand, applicable to any sequence of words. What is {SWAP Hello} ? Or {SWAP one two three} ? > It's a mistery. A mystery, even:-)
- martyalain 2y agoHello John, As explained in this page - http://lambdaway.fr/workshop/?view=coding http://lambdaway.fr/workshop/?view=coding the lambdatalk evaluator is built so that: 3) lambdas are special forms evaluated to a single word - a function's reference added to a dictionary, initially empty - and follow these 3 rules: 3.1) called on a number of words lesser than the number of arguments, a lambda memorizes the given words and returns a new lambda waiting for missing words, 3.2) called on a number of words equal to the number of arguments a lambda returns a word or a sequence of words, 3.3) called on a number of words greater than the number of arguments, the last one gets the exceeding words and the lambda returns a word or a sequence of words. So: 1) {SWAP Hello}, ie {{lambda {:a :b} :b :a} Hello}, replaces :a by Hello and returns the anonymous unary function {lambda {:b} :b Hello} waiting for the missing one, 2) {SWAP Hello World} replaces :a by Hello and :b by World and returns "World Hello", 3) {SWAP one two three} replaces :a by "one", :b by all following words, here "two three", and returns "two three one" The javascript code can be seen in the 100 first lines of this file - http://lambdaway.fr/workshop/meca/JS.js http://lambdaway.fr/workshop/meca/JS.js The lambdaway project is introduced in deep here - http://lambdaway.fr/ http://lambdaway.fr/ with a lot of links to plain explanations on the lambdatalk language. Thank you for your interest. Alain