archive-org.com » ORG » I » IOKE.ORG

Total: 746

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".
  • Kind: DefaultBehavior
    arity call arguments code formattedCode inspect message name notice Specs Inactive cells details activatable true kind LexicalMacro Active cells details argumentsCode returns the code for the argument definition arity nil show source method Arity fromArgumentsCode argumentsCode call arguments activates this lecro with the arguments given to call code returns the full code of this lecro as a Text formattedCode returns idiomatically formatted code for this lecro inspect Returns a text

    Original URL path: https://ioke.org/dok/release/kinds/LexicalMacro.html (2016-02-13)
    Open archived version from archive


  • Kind: DefaultBehavior
    self find el el mimics List el length 0 el 0 obj List assoc should return nil for an empty list show source assoc foo should be nil should return nil for a list where it can t find the argument show source bar blah assoc foo should be nil should not fail for a list that includes stuff that isn t lists show source 1 2 3 4 assoc foo should be nil should return a list if it matches show source abc foo 1 2 blah assoc foo should foo 1 2 should return the first list that matches show source abc foo 1 2 blah foo 3 2 assoc foo should foo 1 2 at index takes one argument the index of the element to be returned can be negative and will in that case return indexed from the back of the list if the index is outside the bounds of the list will return nil the argument can also be a range and will in that case interpret the first index as where to start and the second the end the end can be negative and will in that case be from the end if the first argument is negative or after the second an empty list will be returned if the end point is larger than the list the size of the list will be used as the end point List at should return nil if empty list show source list at 0 should be nil list at 10 should be nil list at 0 1 should be nil should return nil if argument is over the size show source list 1 at 1 should be nil should return from the front if the argument is zero or positive show source 1 2 3 4 at 0 should 1 1 2 3 4 at 1 should 2 1 2 3 4 at 2 should 3 1 2 3 4 at 3 should 4 should return from the back if the argument is negative show source 1 2 3 4 at 0 1 should 4 1 2 3 4 at 0 2 should 3 1 2 3 4 at 0 3 should 2 1 2 3 4 at 0 4 should 1 should validate type of receiver show source List should checkReceiverTypeOn at 0 should validate type of argument show source fn at should signal Condition Error Type IncorrectType at index value takes two arguments the index of the element to set and the value to set the index can be negative and will in that case set indexed from the end of the list if the index is larger than the current size the list will be expanded with nils an exception will be raised if a abs negative index is larger than the size List at should set the first element in an empty list show source x x at 0 42 x length should 1 x 0 should 42 should overwrite an existing element show source x 40 x at 0 42 x length should 1 x 0 should 42 should expand the list up to the point where the element fits if the index is further away show source x 40 42 x at 10 45 x length should 11 x 0 should 40 x 1 should 42 x 2 should be nil x 3 should be nil x 4 should be nil x 5 should be nil x 6 should be nil x 7 should be nil x 8 should be nil x 9 should be nil x 10 should 45 should be possible to set with negative indices show source x 40 42 44 46 x at 2 52 x length should 4 x 0 should 40 x 1 should 42 x 2 should 52 x 3 should 46 should return the value set show source 40 42 44 46 at 0 33 44 should 77 should throw an exception if setting with negative indices outside the range show source fn 1 52 should signal Condition Error Index should validate type of receiver show source 0 1 should checkReceiverTypeOn at 0 3 should validate type of argument show source fn at stilton gouda should signal Condition Error Type IncorrectType butLast n 1 returns all the entries in the list except for the n last one where n is an optional argument that defaults to 1 show source method n 1 end length n if end 0 empty DefaultBehavior 0 end List butLast should return an empty list for the empty list show source butLast should should return an empty list for a list with one entry show source 1 butLast should should return a list with the first entry for a list with two elements show source 1 2 butLast should 1 should return an empty list for a list with two elements when given 2 as an argument show source 1 2 butLast 2 should should return a list with several entries for a longer list without arguments show source 1 2 3 4 5 6 butLast should 1 2 3 4 5 should return a list with several entries for a longer list with an argument of 3 show source 1 2 3 4 5 6 7 butLast 3 should 1 2 3 4 should return the list with the same entries for an argument of zero show source 1 2 3 4 5 6 butLast 0 should 1 2 3 4 5 6 choose quantity nil chooses a random element from the list If a quantity is specified it returns a sequence of random elements each chosen from the complete list and therefore may contain duplicates show source method quantity nil if quantity outerList self left quantity Sequence with next fnx left 0 next fnx left outerList random random List choose should take zero arguments and return a random element from the list show source l sam sooze beans p l choose l should include p should take one argument specifying the quantity and return a sequence containing that many random elements show source l sam sooze beans s l choose 3 s next should true taken s take 3 taken length should 3 taken each el l should include el should not modify the original list show source l sam sooze beans l choose l length should 3 l should sam sooze beans l sam sooze beans l choose 3 l length should 3 l should sam sooze beans clear will remove all the entries from the list and then returns the list List clear should not do anything on an empty list show source x x clear x size should 0 should clear a list that has entries show source x 1 2 3 4 x clear x size should 0 should return the list show source x 1 2 3 4 x clear should x should validate type of receiver show source List should checkReceiverTypeOn clear collect nil List collect should return an empty list for an empty enumerable show source collect x x 2 should should return the same list for something that only returns itself show source 1 2 3 collect x x should 1 2 3 should take one argument and apply the inside show source 1 2 3 collect 2 should 3 4 5 1 2 3 collect 1 should 1 1 1 should take two arguments and apply the code with the argument name bound show source 1 2 3 collect x x 3 should 4 5 6 1 2 3 collect x 1 should 1 1 1 should return the origin list show source x 1 2 3 x collect x 1 should be same x should modify the original list show source x 1 2 3 x collect x 1 x should 1 1 1 compact returns a new list that is a mimic of the current list except that all nils are removed from it show source method newList self mimic newList compact newList List compact should return an empty list for an empty list show source compact should should return a list without nils show source nil compact should nil 1 compact should 1 1 nil 1 compact should 1 1 1 nil compact should 1 1 2 3 nil nil nil nil nil bah nil compact should 1 2 3 nil bah should leave a list without nils unmodified show source a compact should a a b 123 compact should a b 123 should not remove false values show source false compact should false should not modify the original list show source x nil 1 x compact x should nil 1 compact removes all nils in this list and then returns the list List compact should return the list show source x 1 2 3 x compact should be same x should leave an empty list unmodified show source x x compact x should should remove all nils in the list show source nil compact should nil 1 compact should 1 1 nil 1 compact should 1 1 1 nil compact should 1 1 2 3 nil nil nil nil nil bah nil compact should 1 2 3 nil bah should leave a list without nils unmodified show source a compact should a a b 123 compact should a b 123 should not remove false values show source false compact should false should modify the original list show source x 1 nil x compact x should 1 concat otherList adds the elements in the argument list to the current list and then returns that list List concat should change nothing for an empty list show source x 1 x concat x should 1 should append the other list show source concat 1 should 1 foo abc concat blarg 1 should foo abc blarg 1 should modify the receiver show source x 1 x concat 2 x should 1 2 should return the list show source x 1 x concat 2 should be same x each indexOrArgOrCode nil argOrCode nil code nil takes either one or two or three arguments if one argument is given it should be a message chain that will be sent to each object in the list the result will be thrown away if two arguments are given the first is an unevaluated name that will be set to each of the values in the list in succession and then the second argument will be evaluated in a scope with that argument in it if three arguments is given the first one is an unevaluated name that will be set to the index of each element and the other two arguments are the name of the argument for the value and the actual code the code will evaluate in a lexical context and if the argument name is available outside the context it will be shadowed the method will return the list List each should return a seq when given no arguments show source x each x should mimic Sequence should not do anything for an empty list show source x 0 each x x should 0 should be possible to just give it a message chain that will be invoked on each object show source Ground y Ground xs method y self 1 2 3 each xs y should 1 2 3 x 0 1 2 3 each nil x x should 3 should be possible to give it an argument name and code show source y 1 2 3 each x y x y should 1 2 3 should return the object show source y 1 2 3 y each x x should be y should establish a lexical context when invoking the methods this context will be the same for all invocations show source 1 2 3 each x list blarg 32 cell x list should be false cell blarg should be false x 14 1 2 3 each x blarg 32 x should 14 should be possible to give it an extra argument to get the index show source y 1 2 3 4 each i x y i x y should 0 1 1 2 2 3 3 4 should yield lists if running over a list of lists show source y 1 2 3 each x y x y should 1 2 3 should validate type of receiver show source List should checkReceiverTypeOn each 1 empty returns true if this list is empty false otherwise List empty should return true for an empty list show source x x empty should be true should return false for an non empty list show source x 1 x empty should be false x abc cde x empty should be false should validate type of receiver show source List should checkReceiverTypeOn empty flatten returns a new list that is a mimic of the current list with all elements flattened in it show source method newList self mimic newList flatten newList List flatten should return an empty list for an empty list show source flatten should should not touch non list elements show source 1 2 3 foo flatten should 1 2 3 foo 1 2 3 set foo flatten should 1 2 3 set foo should flatten all lists into the end result recursively show source 1 flatten should 1 2 1 1 flatten should 2 1 1 2 1 1 flatten should 2 1 1 2 1 1 flatten should 2 1 1 2 1 1 flatten should 2 1 1 should not modify the receiver show source x 1 x flatten x should 1 should not modify any of the internal lists show source int 1 2 3 x int int x flatten int should 1 2 3 flatten flattens all lists in this list recursively then returns it List flatten should return an empty list for an empty list show source flatten should should not touch non list elements show source 1 2 3 foo flatten should 1 2 3 foo 1 2 3 set foo flatten should 1 2 3 set foo should flatten all lists into the end result recursively show source 1 flatten should 1 2 1 1 flatten should 2 1 1 2 1 1 flatten should 2 1 1 2 1 1 flatten should 2 1 1 2 1 1 flatten should 2 1 1 should modify the receiver show source x 1 x flatten x should 1 should return the receiver show source x 1 x flatten should be same x should not modify any of the internal lists show source int 1 2 3 x int int x flatten int should 1 2 3 hash returns a hash for the list List hash should return the same number for equal lists show source hash should hash x 1 y y 1 x hash should y hash x hash should not hash should return different numbers for different lists show source 1 hash should not 1 hash hash should not 1 hash 1 hash should not hash should do the computation using recursive applications of hash show source x Origin mimic y Origin mimic x hash should not y x hash method 42 y hash method 42 x hash should y hash ifEmpty if this list is empty returns the result of evaluating the argument otherwise returns the list show source macro argCount call arguments length cond argCount 1 then call arguments 0 if empty call argAt 0 self error Condition Error Invocation NoMatch message call message context call currentContext List ifEmpty should just return itself if not empty show source 1 ifEmpty x 0 should 1 1 2 3 ifEmpty x 0 should 1 2 3 x 1 2 x ifEmpty blarg should be same x should return the result of evaluating the code if empty show source ifEmpty 42 should 42 ifEmpty 1 2 3 should 1 2 3 include object returns true if the receiver includes the evaluated argument otherwise false List include should return false for something not in the list show source include foo should be false 1 include 2 should be false 1 foo bar include 2 should be false should return true for something in the list show source foo include foo should be true 1 2 include 2 should be true 2 1 foo bar include 2 should be true should validate type of receiver show source List should checkReceiverTypeOn include Richard Richard index obj takes an object and returns the index of the first occurance of that object in this list or nil if it doesn t exist show source method obj self each index element if element obj return index nil List index should return the index of the first element to object show source x Origin mimic x method obj 3 obj 2 x 3 1 3 1 index 3 should 1 should return 0 if first element to object show source 2 1 3 2 5 index 2 should 0 should return size 1 if only last element to object show source 2 1 3 1 5 index 5 should 4 should return nil if no element to object show source 2 1 1 1 1 index 3 should be nil insert index objects takes an index and zero or more objects to insert at that point the index can be negative to index from the end of the list if the index is positive and larger than the size of the list the list will be filled with nils inbetween List insert inserts objects before the element at index for non negative index show source ary ary insert 0 3 should ary ary should 3 ary insert 0 1 2 should ary ary should 1 2 3 ary insert 0 ary should 1 2 3 ary insert 1 a should 1 a 2 3 ary insert 0 b should b 1 a 2 3 ary insert 5 c should b 1 a 2 3 c ary insert 7 d should b 1 a 2 3 c nil d ary insert 10 5 4 should b 1 a 2 3 c nil d nil nil 5 4 appends objects to the end of the array for index 1 show source 1 3 3 insert 1 2 x 5 should 1 3 3 2 x 5 inserts objects after the element at index with negative index show source ary ary insert 1 3 should 3 ary insert 2 2 should 2 3 ary insert 3 1 should 1 2 3 ary insert 2 3 should 1 2 3 3 ary insert 1 should 1 2 3 3 ary insert 2 x y should 1 2 3 3 x y pads with nils if the index to be inserted to is past the end show source insert 5 5 should nil nil nil nil nil 5 can insert before the first element with a negative index show source 1 2 3 insert 4 3 should 3 1 2 3 raises an IndexError if the negative index is out of bounds show source fn insert 2 1 should signal Condition Error Index fn 1 insert 3 2 should signal Condition Error Index does nothing if no object is passed show source insert 0 should insert 1 should insert 10 should insert 2 should inspect Returns a text inspection of the object List inspect should return something within square brackets show source inspect should should return the inspect format of things inside show source method nil method f f b fn a b inspect should method nil method f f b fn a b should return the list of elements separated with show source 1 2 foo bar inspect should 1 2 foo bar should validate type of receiver show source List should checkReceiverTypeOn inspect join separator returns a text composed of the asText representation of all elements in the list separated by the separator the separator defaults to an empty text List join returns an empty text if the List is empty show source a a join should returns a text formed by concatenating each element asText separated by separator without trailing separator show source obj Origin with asText foo 1 2 3 4 obj join should 1 2 3 4 foo uses the same separator with nested list show source 1 2 3 4 5 6 join should 1 2 3 4 5 6 should default to the empty text as separator show source 1 2 3 join should 123 does not process the separator if the list is empty show source a sep Origin mimic a join sep should last returns the last element of this list or nil of the list is empty show source method if empty nil 0 1 List last should return nil for an empty list show source last should be nil should return the only entry for a list with one element show source 45 last should 45 should return the last entry for a list with more than one entry show source 33 15 45 57 last should 57 length nil List length should return zero for an empty list show source x x length should 0 should return the size for a non empty list show source 1 length should 1 abc cde length should 2 should validate type of receiver show source List should checkReceiverTypeOn length map argOrCode code nil takes one or two arguments and will then use these arguments as code to transform each element in this list the transform happens in place finally the method will return the receiver List map should return an empty list for an empty enumerable show source map x x 2 should should return the same list for something that only returns itself show source 1 2 3 map x x should 1 2 3 should take one argument and apply the inside show source 1 2 3 map 2 should 3 4 5 1 2 3 map 1 should 1 1 1 should take two arguments and apply the code with the argument name bound show source 1 2 3 map x x 3 should 4 5 6 1 2 3 map x 1 should 1 1 1 should return the origin list show source x 1 2 3 x map x 1 should be same x should modify the original list show source x 1 2 3 x map x 1 x should 1 1 1 notice Returns a brief text inspection of the object List notice should return something within square brackets show source notice should should return the notice format of things inside show source method method fn notice should method method fn should return the list of elements separated with show source 1 2 foo bar notice should 1 2 foo bar should validate type of receiver show source List should checkReceiverTypeOn notice pick quantity nil picks a random element from the list If a quantity is specified it returns a list of that size picked randomly which is a subset of the original list If the specified quantity is greater than the length of the list the returned list will be padded with nils show source method quantity nil if quantity result list notPicked self mimic quantity times result notPicked removeAt System randomNumber notPicked length result random List pick should take zero arguments and return a random element from the list show source l sam sooze beans p l pick l should include p should take one argument and return a subset list of that length padded with nils if necessary show source l sam sooze beans l pick 1 length should 1 l pick 2 length should 2 l pick 100 length should 100 l pick 2 each el l should include el l pick l length sort should l sort l pick 7 l should nil nil nil nil should not modify the original list show source l sam sooze beans l pick 2 l should sam sooze beans pick quantity nil picks and removes a random element from the list If a quantity is specified it modifies the list by removing that many random elements and returning them in a new list If the specified quantity is greater than the length of the list the returned list will be padded with nils show source method quantity nil if quantity result list quantity times if length 0 result removeAt randomIndex result nil result removeAt randomIndex List pick should take zero arguments and remove and return a random element from the list show source l sam sooze beans p l pick sam sooze beans should include p should take one argument and return a subset list of that length padded with nils if necessary show source sam sooze beans pick 1 length should 1 sam sooze beans pick 2 length should 2 sam sooze beans pick 100 length should 100 sam sooze beans pick 2 each el sam sooze beans should include el sam sooze beans pick 3 sort should sam sooze beans sort sam sooze beans pick 7 sam sooze beans should nil nil nil nil should modify the original list show source l sam sooze beans l pick l should not sam sooze beans l size should 2 l2 sam sooze beans l2 pick 2 l2 should not sam sooze beans l2 size should 1 pop removes the last element from the list and returns it returns nil if the list is empty List pop should return nil for an empty list show source pop should be nil should return the element for a list with one element show source blarg pop should blarg should remove the element in a list with one element show source l blarg l pop l should should return the last element for a list with more than one element show source blem flag moppy pop should moppy should remove the last element in a list with more than one element show source l blem flag moppy l pop l should blem flag l pop l should blem should validate type of receiver show source List should checkReceiverTypeOn pop prepend value takes one argument and adds it at the beginning of the list and then returns the list List prepend should add an element to an empty list show source l l prepend foo l should foo should add an element at the beginning of a list with elements in it show source l foo bar 1 42 l prepend flax l should flax foo bar 1 42 should add an element several times if asked to show source l foo l prepend foo l prepend foo l prepend foo l prepend foo l should foo foo foo foo foo should return the list show source l l prepend foo should l should validate type of receiver show source List should checkReceiverTypeOn prepend 0 push nil List push should add an element to an empty list show source l l push foo l should foo should add an element at the end of a list with elements in it show source l foo bar 1 42 l push flax l should foo bar 1 42 flax should add an element several times if asked to show source l foo l push foo l push foo l push foo l push foo l should foo foo foo foo foo should return the list show source l l push foo should l should validate type of receiver show source List should checkReceiverTypeOn push 0 random returns a random element from the list Returns nil if the list is empty show source method if length 0 System randomNumber length nil List random should return an element from the list show source l sam sooze beans r l random l should include r should return nil if the list is empty show source random should be nil randomIndex returns the index of a random element from the list Returns nil if the list is empty show source method if length 0 System randomNumber length nil List randomIndex should return an integer within the range 0 list length show source l sam sooze beans r l randomIndex 0 l length asList should include r should return nil if the list is empty show source randomIndex should be nil rassoc obj takes an object and returns the first list in this list that has that object as its second element if it can t be found returns nil show source method obj self find el el mimics List el length 1 el 1 obj List rassoc should return nil for an empty list show source rassoc foo should be nil should return nil for a list where it can t find the argument show source 1 bar 2 blah rassoc foo should be nil should not fail for a list that includes stuff that isn t lists show source 1 2 3 4 rassoc foo should be nil should return a list if it matches show source 1 abc 2 foo 1 2 3 blah rassoc foo should 2 foo 1 2 should return the first list that matches show source 1 abc 2 foo 1 2 3 blah 4 foo 3 2 rassoc foo should 2 foo 1 2 remove element elements takes one or more arguments removes all occurrences of the provided arguments from the list and returns the updated list if an argument is not contained the list remains unchanged sending this method to an empty list has no effect List remove should return empty list if receiver is empty list show source remove 1 should remove a should remove 1 2 should remove a b should should remove all occurrences of single argument show source 1 2 3 4 1 2 3 4 remove 2 should 1 3 4 1 3 4 a b c a b c remove b should a c a c should remove all occurrences of multiple arguments show source 1 2 3 4 1 2 3 4 remove 1 3 should 2 4 2 4 1 2 3 4 1 2 3 4 remove 1 2 3 4 should a b c a b c remove a b c should a b c a b c remove a b should c c should leave list unmodified if arguments not contained in list show source 1 2 3 4 remove 5 should 1 2 3 4 1 2 3 4 remove 5 6 7 should 1 2 3 4 a b c remove x should a b c a b c remove x y z should a b c should skip arguments not contained in list show source 1 2 3 4 1 2 3 4 remove 2 3 5 6 should 1 4 1 4 a b c a b c remove a b x y should c c should validate type of receiver show source List should checkReceiverTypeOn remove 0 removeAt indexOrRange takes as argument the index of the element to be removed and returns it can be negative and will in that case index from the back of the list if the index is outside the bounds of the list will return nil the argument can also be a range and will in that case remove the sublist beginning at the first index and extending to the position in the list specified by the second index inclusive or exclusive depending on the range the end of the range can be negative and will in that case index from the back of the list if the start of the range is negative or greater than the end an empty list will be returned if the end index exceeds the bounds of the list its size will be used instead List removeAt should return nil if receiver is empty list show source list removeAt 0 should be nil list removeAt 10 should be nil list removeAt 1 should be nil should return nil if argument is greater than the list s size show source list 1 removeAt 1 should be nil should remove element from front if argument is zero or positive show source l 1 2 3 4 l removeAt 0 should 1 l should 2 3 4 l 1 2 3 4 l removeAt 1 should 2 l should 1 3 4 l 1 2 3 4 l removeAt 2 should 3 l should 1 2 4 l 1 2 3 4 l removeAt 3 should 4 l should 1 2 3 should remove element from back if argument is negative show source l 1 2 3 4 l removeAt 1 should 4 l should 1 2 3 l 1 2 3 4 l removeAt 2 should 3 l should 1 2 4 l 1 2 3 4 l removeAt 3 should 2 l should 1 3 4 l 1 2 3 4 l removeAt 4 should 1 l should 2 3 4 should not remove anything for any range if reveicer is empty list show source l l removeAt 0 0 should l should l l removeAt 0 0 should l should l l removeAt 0 1 should l should l l removeAt 0 1 should l should l l removeAt 10 20 should l should l l removeAt 10 20 should l should l l removeAt 1 20 should l should should remove all elements for 0 1 show source l l removeAt 0 1 should l should l 1 2 3 l removeAt 0 1 should 1 2 3 l should l x y l removeAt 0 1 should x y l should should remove all except first element for 1 1 show source l 1 l removeAt 1 1 should l should 1 l 1 2 3 l removeAt 1 1 should 2 3 l should 1 l x y l removeAt 1 1 should y l should x should remove all except first and last element for 1 1 show source l 1 2 l removeAt 1 1 should l should 1 2 l 1 2 3 l removeAt 1 1 should 2 l should 1 3 l x y zed bar l removeAt 1 1 should y zed l should x bar should remove first element for 0 0 show source l 1 l removeAt 0 0 should 1 l should l 1 2 3 l removeAt 0 0 should 1 l should 2 3 l x y l removeAt 0 0 should x l should y should not remove anything for 0 0 show source l 1 l removeAt 0 0 should l should 1 l 1 2 3 l removeAt 0 0 should l should 1 2 3 l x y l removeAt 0 0 should l should x y should remove sublist for inclusive range show source l 1 2 3 4 5 6 7 8 9 10 11 l removeAt 3 5 should 4 5 6 l should 1 2 3 7 8 9 10 11 should remove sublist for exclusive range show source l 1 2 3 4 5 6 7 8 9 10 11 l removeAt 3 6 should 4 5 6 l should 1 2 3 7 8 9 10 11 should remove sublist for inclusive range that ends in negative index show source l 1 2 3 4 5 6 7 8 9 10 11 l removeAt 3 3 should 4 5 6 7 8 9 l should 1 2 3 10 11 should remove sublist for exclusive range that ends in negative index show source l 1 2 3 4 5 6 7 8 9 10 11 l removeAt 3 3 should 4 5 6 7 8 l should 1 2 3 9 10 11 should remove all elements to end of list for range that ends in index greater than list s size show source l 1 2 3 4 5 6 7 8 9 10 11

    Original URL path: https://ioke.org/dok/release/kinds/List.html (2016-02-13)
    Open archived version from archive

  • Kind: DefaultBehavior
    a lexical context when invoking the methods this context will be the same for all invocations show source foo bar quux each x list blarg 32 cell x list should be false cell blarg should be false x 14 foo bar quux each x blarg 32 x should 14 should be possible to give it an extra argument to get the index show source y foo bar baz quux each i x y i x name y should 0 foo 1 bar 2 baz 3 quux should validate type of receiver show source Message should checkReceiverTypeOn each evalArgAt argumentIndex context takes one index and a context and returns the evaluated argument at that index evaluateOn ground receiver ground arguments Takes one or more evaluated arguments and sends this message chain to where the first argument is ground and if there are more arguments the second is the receiver and the rest will be the arguments Message evaluateOn should be possible to create a message from text with arguments and send that to a number show source Message fromText 200 evaluateOn 20 should 220 should possible to send a simple message that is not predefined show source Ground f method self asText Message fromText f evaluateOn 42 should 42 should evaluate the full message chain show source Message fromText 200 10 5 evaluateOn 20 should 225 filename returns the file name where this message is written Message filename should be preserved on mimic show source m1 foo m2 m1 mimic m2 filename should m1 filename formattedCode Returns a formatted code representation of the object from returns the message chain for the argument given show source macro argCount call arguments length cond argCount 1 code call arguments 0 code deepCopy error Condition Error Invocation NoMatch message call message context call currentContext Message from should return the things inside unevaluated show source Message from 200 name should Message from abc foo bar quux lux name should abc fromText code Takes one evaluated argument and returns the message resulting from parsing and operator shuffling the resulting message Message fromText should return a message from the text show source Message fromText foo name should foo Message fromText foo bar next name should bar keyword returns true if this message is a keyword parameter or not Message keyword should return true for a message that ends with a colon show source Message fromText foo keyword should be true Message fromText bar keyword should be true should return false for something simple show source Message fromText foo keyword should be false should return false for the empty message show source Message fromText keyword should be false should validate type of receiver show source Message should checkReceiverTypeOn keyword last returns the last message in the chain line returns the line where this message is written Message line should be preserved on mimic show source m1 foo m2 m1 mimic m2 line should m1 line name returns the name of this message Message name should return the name of something simple show source Message fromText foo name should foo should return an empty name show source Message fromText name should should return a name with a question mark show source Message fromText blarg name should blarg should validate type of receiver show source Message should checkReceiverTypeOn name name newName sets the name of the message and then returns that name Message name should validate type of receiver show source Message should checkReceiverTypeOn name foo next returns the next message in the chain or nil Message next should return nil if there is no next show source Message fromText foo next should be nil should return the next pointer show source Message fromText foo bar next name should bar Message fromText foo 123 321 bar next name should bar should validate type of receiver show source Message should checkReceiverTypeOn next next newNext sets the next pointer of the message and then returns that pointer Message next should set the next pointer show source msg Message fromText foo bar val msg cell next msg next nil msg next should be nil msg cell next cell val should be true should validate type of argument show source fn Message next should signal Condition Error Type IncorrectType should validate type of receiver show source Message should checkReceiverTypeOn next foo position returns the position on the line where this message is written Message position should be preserved on mimic show source m1 foo m2 m1 mimic m2 position should m1 position prev returns the previous message in the chain or nil Message prev should return nil if there is no next show source Message fromText foo prev should be nil should return the prev pointer show source Message fromText foo bar next prev name should foo Message fromText foo 123 321 bar next prev name should foo should validate type of receiver show source Message should checkReceiverTypeOn next prev newPrev sets the prev pointer of the message and then returns that pointer Message prev should validate type of receiver show source Message should checkReceiverTypeOn prev foo should set the prev pointer show source msg Message fromText foo bar val msg next cell prev msg next prev nil msg next prev should be nil msg next cell prev cell val should be true should validate type of argument show source fn Message prev should signal Condition Error Type IncorrectType should validate type of receiver show source Message should checkReceiverTypeOn prev foo rewrite patterns Takes zero or more pairs of message chains that describe how rewriting of the current message chain should happen The message patterns can use symbols to match variable pieces of the pattern show source method patterns patterns inject self current pattern Rewriter rewrite current pattern Message rewrite should rewrite a very simple message chain show source msg foo output msg rewrite x something x msg should foo output should something foo should rewrite a next into an argument show source msg foo bar output msg rewrite x y x y output should

    Original URL path: https://ioke.org/dok/release/kinds/Message.html (2016-02-13)
    Open archived version from archive

  • Kind: DefaultBehavior
    32 trinaryOperators 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 Active cells details withInvertedOperator temporarily adds a new inverted operator with the specified associativity and then removes it again if the operator is already in there changes the associativity temporarily show source macro argCount call arguments length cond argCount 3 name call argAt 0 assoc call argAt 1 code call arguments 2 if name mimics Text name name let Message OperatorTable invertedOperators Message OperatorTable invertedOperators merge name assoc code evaluateOn call ground call ground error Condition Error Invocation NoMatch message call message context call currentContext Message OperatorTable withInvertedOperator should temporarily add a new inverted operator to the table but then remove it show source Message OperatorTable withInvertedOperator 42 Message OperatorTable invertedOperators should 42 Message OperatorTable invertedOperators should be nil should reassign the associativity of an existing operator show source Message OperatorTable withInvertedOperator 42 Message OperatorTable invertedOperators should 42 Message OperatorTable invertedOperators should 12 withOperator temporarily adds a new operator with the specified associativity and then removes it again if the operator is already in there changes the associativity temporarily show source macro argCount call arguments length cond argCount 3 name call argAt 0 assoc call argAt 1 code call arguments 2 if name mimics Text name name let Message OperatorTable operators Message OperatorTable operators merge name assoc code evaluateOn call ground call ground error Condition Error Invocation NoMatch message call message context call currentContext Message OperatorTable withOperator should temporarily add a new operator to the table but then remove it show source Message OperatorTable withOperator 42 Message OperatorTable operators should 42 Message OperatorTable operators should be nil should reassign the associativity of an existing operator show source Message OperatorTable withOperator 42 Message OperatorTable operators should 42 Message OperatorTable operators should 3 withTrinaryOperator

    Original URL path: https://ioke.org/dok/release/kinds/Message/OperatorTable.html (2016-02-13)
    Open archived version from archive

  • Kind: DefaultBehavior
    msg m msg arguments m msg arguments map mm if Unification internal literal mm mm rewrite mm pattern true m match m msg pattern key result if m rewriteWith m pattern value m msg mimic m msg arguments oldArguments if start nil start result current start last current result current current last if m m nexts times if m msg m msg m msg next m msg m msg next

    Original URL path: https://ioke.org/dok/release/kinds/Message/Rewriter.html (2016-02-13)
    Open archived version from archive

  • Kind: DefaultBehavior
    until 2 stopsym p arguments 0 name nm p arguments 1 name count 0 curr msg until curr nil curr name stopsym curr curr next count if curr nil return 1 count unifications nm msg count count else if name not p arguments length 0 capture nil avoidNames p arguments map name if p arguments last symbol capture p arguments last avoidNames removeAt avoidNames size 1 if avoidNames include msg name 1 if capture unifications capture name msg 1 1 unifications name msg 1 1 initialize nil show source method unifications nexts 0 internal eitherLiteral pattern msg nil show source method pattern msg internal literal pattern internal literal msg internal literal msg nil show source method msg if msg name asText internal true false internal macroSymbol p nil show source method p p name all p name until p name not p arguments length 0 internal unify pattern msg countNexts false nil show source method pattern msg countNexts false p pattern m msg while p unless m return false amount 1 if p symbol amount addUnification p name p m if amount 1 return false unless p name m name return false unless internal macroSymbol p if internal eitherLiteral p

    Original URL path: https://ioke.org/dok/release/kinds/Message/Rewriter/Unification.html (2016-02-13)
    Open archived version from archive

  • Kind: DefaultBehavior
    Active cells call arguments code inspect name notice Specs Inactive cells details activatable true kind Method Active cells details call arguments activates this method with the arguments given to call code returns the full code of this method as a

    Original URL path: https://ioke.org/dok/release/kinds/Method.html (2016-02-13)
    Open archived version from archive

  • Kind: DefaultBehavior
    Comparing x 43 Mixins Comparing cell x should Mixins Comparing x should report an error if trying to get a cell that doesn t exist in that object show source fn Mixins cell mixins spec non existing should signal Condition Error NoSuchCell fn Mixins cell mixins spec non existing should signal Condition Error NoSuchCell fn Mixins Comparing cell mixins spec non existing should signal Condition Error NoSuchCell fn Mixins Comparing cell mixins spec non existing should signal Condition Error NoSuchCell cell cellName value expects one evaluated text or symbol argument that names the cell to set sets this cell to the result of evaluating the second argument and returns the value set Mixins cell should be possible to set a cell using a Text argument show source Mixins cell blurg 42 Mixins blurg should 42 Mixins Comparing cell murg 43 Mixins Comparing murg should 43 should be possible to set a cell using a Symbol argument show source Mixins cell blurg 42 Mixins blurg should 42 Mixins Comparing cell murg 43 Mixins Comparing murg should 43 should be possible to set a cell with an empty name show source oldEmpty cell Mixins Comparing cell 42 Mixins Comparing cell should 42 Mixins Comparing cell cell oldEmpty should be possible to set a cell with complicated expressions show source f Origin mimic f b foobar Mixins cell f b 42 24 3 Mixins cell foobar should 63 should be possible to set a cell that doesn t exist show source Mixins cell blurg 42 Mixins blurg should 42 Mixins Comparing cell murg 43 Mixins Comparing murg should 43 should be possible to set a cell that does exist show source Mixins x 42 Mixins cell x 43 Mixins x should 43 Mixins Comparing x 42 Mixins Comparing cell x 44 Mixins Comparing

    Original URL path: https://ioke.org/dok/release/kinds/Mixins.html (2016-02-13)
    Open archived version from archive



  •