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".
  • MediaWiki:Common.css - IokeWiki
    Helvetica Neue Helvetica Arial sans serif color 000 text decoration none font size 1 1em a href hover text decoration underline li selected a font weight bold dt code font family courier color black pre code display block background color black color white font family courier margin 75em 0 border 1px dotted ccc border width 1px 0 padding 5px 15px overflow auto font size 1 0em portlet ul list style

    Original URL path: https://ioke.org/wiki/index.php?title=MediaWiki:Common.css&diff=prev&oldid=26 (2016-02-13)
    Open archived version from archive


  • MediaWiki:Common.css - IokeWiki
    Sans Serif background fff a href font family Helvetica Neue Helvetica Arial sans serif color 000 text decoration none font size 1 1em a href hover text decoration underline li selected a font weight bold dt code font family courier color black pre code display block background color black color white font family courier margin 75em 0 border 1px dotted ccc border width 1px 0 padding 5px 15px overflow auto

    Original URL path: https://ioke.org/wiki/index.php?title=MediaWiki:Common.css&diff=prev&oldid=25 (2016-02-13)
    Open archived version from archive

  • User contributions - IokeWiki
    Core kinds 01 02 24 November 2010 hist diff Guide Assignment 01 01 24 November 2010 hist diff Guide Aspects 01 00 24 November 2010 hist diff Future plans 01 00 24 November 2010 hist diff Java integration planning 01 00 24 November 2010 hist diff Concurrency planning 01 00 24 November 2010 hist diff Cane 00 58 24 November 2010 hist diff Guide Introduction 00 57 24 November 2010

    Original URL path: https://ioke.org/wiki/index.php?title=Special:Contributions&limit=20&target=Icotime&month=&year= (2016-02-13)
    Open archived version from archive

  • Guide:Code - IokeWiki
    blarg 42 2 3 4 foo quux 42 2 source foo quux 42 2 lt source gt To give a keyword argument you just write it exactly like you define keyword arugments a name followed by a colon To give a keyword argument you just write it exactly like you define keyword arugments a name followed by a colon Sometimes it can be useful to be able to take a list of values and give them as positional arguments The same can be useful to do with a dict of names You can do that using splatting This is done by preceding a list or a dict with an asterisk This will result in the method getting the values inside of it as if the arguments were given directly You can splat several things to the same invocation Sometimes it can be useful to be able to take a list of values and give them as positional arguments The same can be useful to do with a dict of names You can do that using splatting This is done by preceding a list or a dict with an asterisk This will result in the method getting the values inside of it as if the arguments were given directly You can splat several things to the same invocation source lang ioke dc foo 42 bar 13 lt source lang quot ioke quot gt dc foo 42 bar 13 ls 1 2 3 4 ls 1 2 3 4 ls2 42 43 44 ls2 42 43 44 foo ls2 111 dc ls foo ls2 111 dc ls the same as the same as foo 42 43 44 111 foo 42 bar 13 1 2 3 4 source foo 42 43 44 111 foo 42 bar 13 1 2 3 4 lt source gt If you try to splat something that can t be splatted a condition will be signalled If you try to splat something that can t be splatted a condition will be signalled Macros Macros The main difference between a macro and a method in Ioke is that the arguments to a macro are not evaluated before they are sent to the macro That means you have to use macros to send raw message chains in an invocation In most languages this kind of feature is generally called call by name When a macro gets called it will get access to a cell called quot call quot which is a mimic of the kind Call This gives access to information about the call and makes it possible to evaluate the code sent as arguments check how many arguments are supplied and so on The main difference between a macro and a method in Ioke is that the arguments to a macro are not evaluated before they are sent to the macro That means you have to use macros to send raw message chains in an invocation In most languages this kind of feature is generally called call by name When a macro gets called it will get access to a cell called amp quot call amp quot which is a mimic of the kind Call This gives access to information about the call and makes it possible to evaluate the code sent as arguments check how many arguments are supplied and so on A macro is created using the quot macro quot cell on DefaultBehavior This will return a mimic of DefaultMacro Since macros can t define arguments it s a bit easier to describe than methods but the things that can be done with macros are also a bit more interesting than what can be achieved with methods One important thing to keep in mind is that most macros can not receive splatted arguments In most cases keyword arguments aren t available either but they could be faked if needed Macros should generally be used to implement control structures and things that need to manipulate code in different ways A macro is created using the amp quot macro amp quot cell on DefaultBehavior This will return a mimic of DefaultMacro Since macros can t define arguments it s a bit easier to describe than methods but the things that can be done with macros are also a bit more interesting than what can be achieved with methods One important thing to keep in mind is that most macros can not receive splatted arguments In most cases keyword arguments aren t available either but they could be faked if needed Macros should generally be used to implement control structures and things that need to manipulate code in different ways Just like a method a macro gets evaluated on a specific receiver It also gets the same kind of method activation context but the contents of it is a bit different Specifically the context for a macro contains cells named quot self quot quot quot quot currentMessage quot quot surroundingContext quot and quot call quot It s the quot call quot cell that is most important It is a mimic of Call and Call defines several important methods for manipulating the call environment These are Just like a method a macro gets evaluated on a specific receiver It also gets the same kind of method activation context but the contents of it is a bit different Specifically the context for a macro contains cells named amp quot self amp quot amp quot amp quot amp quot currentMessage amp quot amp quot surroundingContext amp quot and amp quot call amp quot It s the amp quot call amp quot cell that is most important It is a mimic of Call and Call defines several important methods for manipulating the call environment These are arguments arguments Returns the ground in which the call was initiated This is necessary to evaluate arguments in their own environment Returns the ground in which the call was initiated This is necessary to evaluate arguments in their own environment message message The currently executing message This is the same as the quot currentMessage quot cell in the macro activation context The currently executing message This is the same as the amp quot currentMessage amp quot cell in the macro activation context evaluatedArguments evaluatedArguments Returns a list containing all arguments evaluated according to the regular rules but not handling splatting or keywords Returns a list containing all arguments evaluated according to the regular rules but not handling splatting or keywords These methods are a bit hard to understand so I ll take some examples from the implementation of Ioke and show how macros are used here These methods are a bit hard to understand so I ll take some examples from the implementation of Ioke and show how macros are used here source lang ioke Mixins Enumerable map macro lt source lang quot ioke quot gt Mixins Enumerable map macro takes one or two arguments if one argument is given quot takes one or two arguments if one argument is given it will be evaluated as a message chain on each element it will be evaluated as a message chain on each element in the enumerable and then the result will be collected in the enumerable and then the result will be collected code it s important to notice that the one argument code it s important to notice that the one argument form will establish no context while the two argument form form will establish no context while the two argument form establishes a new lexical closure establishes a new lexical closure quot len call arguments length len call arguments length if len 1 if len 1 code call arguments first code call arguments first self each n result code evaluateOn call ground cell n self each n result lt lt code evaluateOn call ground cell n code LexicalBlock createFrom call arguments call ground code LexicalBlock createFrom call arguments call ground self each n result code call cell n self each n result lt lt code call cell n result source result lt source gt The code above implements map one of the methods from Enumerable The map method allows one collection to be mapped in a predefined way into something else It can take either one or two arguments If one argument is given that is a message chain to apply and then collect the results If two arguments are given the first is the argument name to use and the second is the code to execute for each entry The code above implements map one of the methods from Enumerable The map method allows one collection to be mapped in a predefined way into something else It can take either one or two arguments If one argument is given that is a message chain to apply and then collect the results If two arguments are given the first is the argument name to use and the second is the code to execute for each entry The first step is to figure out how many arguments have been given This is done by checking the length of the quot call arguments quot cell If we have a length of one we know that the first argument is a piece of code to apply so we assign that argument to a cell called quot code quot Now quot code quot will be a mimic of Message and Message has a method called quot evaluateOn quot that can be used to fully evaluate a message chain And that s exactly what we do for each element in the collection we are in The result of evaluateOn is added to the result list We use quot call ground quot to get the correct ground for the code to be evaluated in The first step is to figure out how many arguments have been given This is done by checking the length of the amp quot call arguments amp quot cell If we have a length of one we know that the first argument is a piece of code to apply so we assign that argument to a cell called amp quot code amp quot Now amp quot code amp quot will be a mimic of Message and Message has a method called amp quot evaluateOn amp quot that can be used to fully evaluate a message chain And that s exactly what we do for each element in the collection we are in The result of evaluateOn is added to the result list We use amp quot call ground amp quot to get the correct ground for the code to be evaluated in If we get two arguments it s possible to take a shortcut and generate a lexical block from those arguments and then use that So we call quot LexicalBlock createFrom quot and send in the arguments and the ground and then call that piece of code once for each element in the collection If we get two arguments it s possible to take a shortcut and generate a lexical block from those arguments and then use that So we call amp quot LexicalBlock createFrom amp quot and send in the arguments and the ground and then call that piece of code once for each element in the collection It is a bit tricky to figure out how macros work I recommend looking at the implementations of some of the core Ioke methods macros since these use much of the functionality It is a bit tricky to figure out how macros work I recommend looking at the implementations of some of the core Ioke methods macros since these use much of the functionality A lexical block allows the execution of a piece of code in the lexical context of some other code instead of in a dynamic object scope A lexical block does not have a receiver Instead it just establishes a new lexical context and executes the code in that The exact effect that has on assignments has been Guide Assignment described earlier A lexical block allows the execution of a piece of code in the lexical context of some other code instead of in a dynamic object scope A lexical block does not have a receiver Instead it just establishes a new lexical context and executes the code in that The exact effect that has on assignments has been Guide Assignment described earlier A lexical block can be created using either the quot fn quot or the quot fnx quot methods of DefaultBehavior The main difference between the two is that a block created with quot fnx quot will be activatable while something created with quot fn quot will not Lexical blocks handle arguments exactly the same way as methods so a lexical block can take optional arguments keyword arguments rest arguments and so on Both quot fn quot and quot fnx quot also take optional documentation text A lexical block can be created using either the amp quot fn amp quot or the amp quot fnx amp quot methods of DefaultBehavior The main difference between the two is that a block created with amp quot fnx amp quot will be activatable while something created with amp quot fn amp quot will not Lexical blocks handle arguments exactly the same way as methods so a lexical block can take optional arguments keyword arguments rest arguments and so on Both amp quot fn amp quot and amp quot fnx amp quot also take optional documentation text A block created with the quot fn quot method can be invoked using the quot call quot method of the kind http ioke org dok kinds LexicalBlock html code LexicalBlock code A block created with the amp quot fn amp quot method can be invoked using the amp quot call amp quot method of the kind http ioke org dok kinds LexicalBlock html lt code gt LexicalBlock lt code gt source lang ioke lt source lang quot ioke quot gt x fn z z println x fn z z println x call 42 x call 42 source lt source gt If a block created with the quot fn quot method takes one or more explicit parameters it can also be activated like a regular method The reason for this is shown in the code snippet below Here the result of invoking the block referred to by quot x quot is passed to quot y quot which may be a regular method or even another block If quot x quot would be fully non activatable quot x quot would be passed to quot y quot as is with the argument thrown away In other words that would be dead code However you can still refer to the block as quot x quot without an invocation to happen If a block created with the amp quot fn amp quot method takes one or more explicit parameters it can also be activated like a regular method The reason for this is shown in the code snippet below Here the result of invoking the block referred to by amp quot x amp quot is passed to amp quot y amp quot which may be a regular method or even another block If amp quot x amp quot would be fully non activatable amp quot x amp quot would be passed to amp quot y amp quot as is with the argument thrown away In other words that would be dead code However you can still refer to the block as amp quot x amp quot without an invocation to happen source lang ioke lt source lang quot ioke quot gt x fn z z 42 x fn z z 42 y x 100 activates the block with argument 100 and passes the result to y y x 100 activates the block with argument 100 and passes the result to y x refers to the block without activating it x refers to the block without activating it source lt source gt A block created with the quot fnx quot method is activatable per se and thus can be activated like a regular method The default is to use quot fn quot to create inactive blocks though since blocks are generally used to pass pieces of code around A block created with the amp quot fnx amp quot method is activatable per se and thus can be activated like a regular method The default is to use amp quot fn amp quot to create inactive blocks though since blocks are generally used to pass pieces of code around source lang ioke lt source lang quot ioke quot gt y fnx z z println y fnx z z println y 42 y 42 source lt source gt A lexical block is a regular kind of object that can be assigned to any cell just like other objects Lexical blocks mimic LexicalBlock and blocks don t have names In contrast to methods and macros no extra cells will be added to the activation context for a lexical block A lexical block is a regular kind of object that can be assigned to any cell just like other objects Lexical blocks mimic LexicalBlock and blocks don t have names In contrast to methods and macros no extra cells will be added to the activation context for a lexical block You can also do several kinds of functional composition of blocks Some of these combinations only make sense for predicates while others are more generally applicable They all expect to work with functions that are OK with only taking one argument though In the following examples f and g are general lexical blocks while p and q are predicates You can also do several kinds of functional composition of blocks Some of these combinations only make sense for predicates while others are more generally applicable They all expect to work with functions that are OK with only taking one argument though In the following examples f and g are general lexical blocks while p and q are predicates code f g

    Original URL path: https://ioke.org/wiki/index.php?title=Guide:Code&diff=prev&oldid=402 (2016-02-13)
    Open archived version from archive

  • Guide:Core kinds - IokeWiki
    same as and at and at is the same as and l at 0 1 l at 0 gt 1 empty the list empty the list l clear l clear l true l gt true follows the each protocol follows the each protocol is empty is empty l empty true l empty gt true does it include an element does it include an element l include foo false l include foo gt false the last element the last element l last nil l last gt nil 1 2 last 2 1 2 last gt 2 the length the length 1 2 length 2 1 2 length gt 2 first value first value 1 2 first 1 1 2 first gt 1 rest except for first rest except for first 1 2 3 rest 2 3 1 2 3 rest gt 2 3 returns a new sorted list returns a new sorted list 3 2 1 sort 1 2 3 3 2 1 sort gt 1 2 3 sorts in place sorts in place l 3 2 1 l 3 2 1 l sort l sort l 1 2 3 true source l 1 2 3 gt true lt source gt Dicts Dicts A Dict is a dictionary of key value mappings The mappings are unordered and there can only ever be one key with the same value Any kind of Ioke object can be used as a key There is no problem with having the same value for different keys The default implementation of Dict uses a hash based implementation That s not necessarily always true for all dicts The iteration order is not necessarily stable either so don t write code that depends on it A Dict is a dictionary of key value mappings The mappings are unordered and there can only ever be one key with the same value Any kind of Ioke object can be used as a key There is no problem with having the same value for different keys The default implementation of Dict uses a hash based implementation That s not necessarily always true for all dicts The iteration order is not necessarily stable either so don t write code that depends on it Creating a dict is done using either the quot dict quot or the quot quot methods Both of these expect either keyword arguments or mimics of Pair If keyword arguments these keywords will be used as symbol keys That s the most common thing so it makes sense to have that happen automatically Dicts also try to print themselves that way Creating a dict is done using either the amp quot dict amp quot or the amp quot amp quot methods Both of these expect either keyword arguments or mimics of Pair If keyword arguments these keywords will be used as symbol keys That s the most common thing so it makes sense to have that happen automatically Dicts also try to print themselves that way source lang ioke dict 1 2 3 4 lt source lang quot ioke quot gt dict 1 gt 2 3 gt 4 these two are the same these two are the same dict foo bar baaz quux dict foo quot bar quot baaz quot quux quot dict foo bar baaz quux dict foo gt quot bar quot baaz gt quot quux quot 1 2 3 4 1 gt 2 3 gt 4 these two are the same these two are the same foo bar baaz quux foo quot bar quot baaz quot quux quot foo bar baaz quux foo gt quot bar quot baaz gt quot quux quot the formats can be combined the formats can be combined 1 2 foo 42 bar qux source 1 gt 2 foo 42 quot bar quot gt quot qux quot lt source gt The literal Pair syntax using gt will not necessarily instantiate real pairs for this The literal Pair syntax using amp gt will not necessarily instantiate real pairs for this Dicts mix in Enumerable When using each what will be yielded are mimics of Pair where the first value will be the key and the second will be value Just like Lists Dicts have several useful methods in themselves Dicts mix in Enumerable When using each what will be yielded are mimics of Pair where the first value will be the key and the second will be value Just like Lists Dicts have several useful methods in themselves source lang ioke d one two 3 4 lt source lang quot ioke quot gt d one quot two quot 3 gt 4 lookup with at works the same lookup with quot at quot works the same d one two d one gt quot two quot d two nil d two gt nil d 3 4 d 3 gt 4 d 4 nil d 4 gt nil assign values with assign values with d one three d one quot three quot d new wow d new quot wow quot d one three 3 4 new wow d one quot three quot 3 gt 4 new quot wow quot iterate over it iterate over it get all keys get all keys d keys set one new 3 source d keys set one new 3 lt source gt Sets Sets If you want an object that work like a mathematical set Ioke provides such a kind for you There is also literal syntax for sets from Ioke E This syntax looks like this code 42 55 111 code A set can be iterated over and it is Enumerable You can add and remove elements and check for membership If you want an object that work like a mathematical set Ioke provides such a kind for you There is also literal syntax for sets from Ioke E This syntax looks like this lt code gt 42 55 111 lt code gt A set can be iterated over and it is Enumerable You can add and remove elements and check for membership source lang ioke x set 1 2 3 3 2 1 lt source lang quot ioke quot gt x set 1 2 3 3 2 1 x map 2 sort 2 4 6 x map 2 sort gt 2 4 6 x 1 true x 1 gt true x 0 false x 0 gt false x remove 2 x remove 2 x 2 false x 2 gt false x 4 x lt lt 4 x 4 true source x 4 gt true lt source gt Sets also have methods to do union and intersection These mimic the mathematical operators for these operations Sets also have methods to do union and intersection These mimic the mathematical operators for these operations source lang ioke intersection lt source lang quot ioke quot gt intersection 1 2 3 4 1 2 3 4 5 should 1 2 3 4 1 2 3 4 1 2 3 4 5 should 1 2 3 4 union union 1 2 1 3 should 1 2 3 1 2 1 3 should 1 2 3 source lt source gt You can also test membership nonmembership subset and superset relations using the mathematical operators You can also test membership nonmembership subset and superset relations using the mathematical operators source lang ioke membership lt source lang quot ioke quot gt membership 42 1 2 42 3 42 1 2 42 3 proper subset proper subset bar foo foo bar quux quot bar quot quot foo quot quot foo quot quot bar quot quot quux quot superset superset proper superset proper superset bar foo quux foo bar quot bar quot quot foo quot quot quux quot quot foo quot quot bar quot source lt source gt Ranges and Pairs Ranges and Pairs Both ranges and pairs tie two values together They also have literal syntax to create them since they are very useful in many circumstances Both ranges and pairs tie two values together They also have literal syntax to create them since they are very useful in many circumstances A Range defines two endpoints A Range is Enumerable and you can also check for membership It s also convenient to send Ranges to the quot List quot method A Range can be exclusive or inclusive If it s inclusive it includes the end value and if it is exclusive it doesn t A Range defines two endpoints A Range is Enumerable and you can also check for membership It s also convenient to send Ranges to the amp quot List amp quot method A Range can be exclusive or inclusive If it s inclusive it includes the end value and if it is exclusive it doesn t An addition to Ioke S is the possibility of inverted ranges If the first value is larger than the second value then the range is inverted This puts slightly different demands on the objects inside of it Specifically if you want to iterate over the elements the kind you re using need to have a method called pred for predecessor instead of succ for successor Membership can still be tested as long as lt gt is defined So you can do something like this quot foo quot quot aoo quot quot boo quot It s mostly useful for iterating in the opposite direction like with 10 1 for example An addition to Ioke S is the possibility of inverted ranges If the first value is larger than the second value then the range is inverted This puts slightly different demands on the objects inside of it Specifically if you want to iterate over the elements the kind you re using need to have a method called pred for predecessor instead of succ for successor Membership can still be tested as long as amp lt amp gt is defined So you can do something like this amp quot foo amp quot amp quot aoo amp quot amp quot boo amp quot It s mostly useful for iterating in the opposite direction like with 10 1 for example source lang ioke literal syntax for inclusive range lt source lang quot ioke quot gt literal syntax for inclusive range 1 10 1 10 check for membership check for membership 1 10 5 true 1 10 5 gt true 1 10 10 true 1 10 10 gt true 1 10 11 false 1 10 11 gt false 1 10 5 true 1 10 5 gt true 1 10 10 false 1 10 10 gt false 1 10 11 false 1 10 11 gt false get the from value get the from value 1 10 from 1 true 1 10 from 1 gt true 1 10 from 1 true 1 10 from 1 gt true get the to value get the to value 1 10 to 10 true 1 10 to 10 gt true 1 10 to 10 true 1 10 to 10 gt true is this range exclusive is this range exclusive 1 10 exclusive false 1 10 exclusive gt false 1 10 exclusive true 1 10 exclusive gt true is this range inclusive is this range inclusive 1 10 inclusive true 1 10 inclusive gt true 1 10 inclusive false source 1 10 inclusive gt false lt source gt A Pair represents a combination of two values They don t have to be of the same kind They can have any kind of relationship Since Pairs are often used to represent the elements of Dicts it is very useful to refer to the first value as the quot key quot and the second value as the quot value quot A Pair represents a combination of two values They don t have to be of the same kind They can have any kind of relationship Since Pairs are often used to represent the elements of Dicts it is very useful to refer to the first value as the amp quot key amp quot and the second value as the amp quot value amp quot source lang ioke literal syntax for a pair lt source lang quot ioke quot gt literal syntax for a pair foo bar quot foo quot gt quot bar quot getting the first value getting the first value foo bar first foo quot foo quot gt quot bar quot first gt quot foo quot foo bar key foo quot foo quot gt quot bar quot key gt quot foo quot getting the second value getting the second value foo bar second bar quot foo quot gt quot bar quot second gt quot bar quot foo bar value bar source quot foo quot gt quot bar quot value gt quot bar quot lt source gt Tuples Tuples A Pair is a special case of wanting to tie two values together The general case of bundling several values together can be achieved by using Tuples If you give anything else than one argument to the empty method you will get back a Tuple You can also create a new tuple explicitly using the code tuple code method A Pair is a special case of wanting to tie two values together The general case of bundling several values together can be achieved by using Tuples If you give anything else than one argument to the empty method you will get back a Tuple You can also create a new tuple explicitly using the lt code gt tuple lt code gt method To extract elements out of the tuple the main way is using destructuring assignment It is also possible to use a named extractor to get a given index To extract elements out of the tuple the main way is using destructuring assignment It is also possible to use a named extractor to get a given index Tuples are by design not Enumerable This is a feature not a misfeature If you use tuples as something that should be enumerated over you re using the wrong data structure Also remember that Enumerable defines asTuple so anything enumerable can be turned into a tuple if needed Tuples are by design not Enumerable This is a feature not a misfeature If you use tuples as something that should be enumerated over you re using the wrong data structure Also remember that Enumerable defines asTuple so anything enumerable can be turned into a tuple if needed source lang ioke t tuple 42 55 18 lt source lang quot ioke quot gt t tuple 42 55 18 x y z t x y z t t third should 18 t third should 18 t 3 should 18 source t 3 should 18 lt source gt As you can see english style names are defined for accessing elements These will only be available up to nine elements The underscore syntax for indexing will always be possible though As you can see english style names are defined for accessing elements These will only be available up to nine elements The underscore syntax for indexing will always be possible though You create a new one by calling the Struct method You create a new one by calling the Struct method source lang ioke Person Struct first name sur name age source lt source lang quot ioke quot gt Person Struct first name sur name age lt source gt You can provide default values using keyword arguments instead You can provide default values using keyword arguments instead source lang ioke Person Struct first name sur name age 1 source lt source lang quot ioke quot gt Person Struct first name sur name age 1 lt source gt Creating a new version of a Struct can be done using the object as a function Creating a new version of a Struct can be done using the object as a function source lang ioke o Person Ola Bini source lt source lang quot ioke quot gt o Person quot Ola quot quot Bini quot lt source gt It is also possible to provide these values using keywords or even a mix It is also possible to provide these values using keywords or even a mix source lang ioke s Person first name Sam sur name Aaron lt source lang quot ioke quot gt s Person first name quot Sam quot sur name quot Aaron quot b Person sur name Guthrie Brian source b Person sur name quot Guthrie quot quot Brian quot lt source gt All of these objects will implement nowiki nowiki hash asText notice and inspect Accessors and mutators also work All of these objects will implement lt nowiki gt lt nowiki gt hash asText notice and inspect Accessors and mutators also work You can get access to all the Struct attributes by calling code attributes code If you just want the names you can use code attributeNames code A Struct instance is also Sequenced over a combination of its keys and values You can get access to all the Struct attributes by calling lt code gt attributes lt code gt If you just want the names you can use lt code gt attributeNames lt code gt A Struct instance is also Sequenced over a combination of its keys and values Enumerable Enumerable Mapping a collection into a another collection can be done using map or mapFn These are aliased as collect and collectFn too Mapping a collection into a another collection can be done using map or mapFn These are aliased as collect and collectFn too source lang ioke l 10 20 30 40 lt source lang quot ioke quot gt l 10 20 30 40 mapping into text mapping into text l map asText 10 20 30 40 l map asText gt quot 10 quot quot 20 quot quot 30 quot quot 40 quot l map n n asText 10 20 30 40 l map n n asText gt quot 10 quot quot 20 quot quot 30 quot quot 40 quot exponentiation exponentiation l map 2 100 400 900 1600 l map 2 gt 100 400 900 1600 l map n n

    Original URL path: https://ioke.org/wiki/index.php?title=Guide:Core_kinds&diff=prev&oldid=401 (2016-02-13)
    Open archived version from archive

  • Guide:Assignment - IokeWiki
    subtle Since the left hand side of the assignment takes arguments the quot quot method figures out that the assignment is not to a simple cell name but to a place The parsing step will change quot cell quot quot 42 quot into quot cell quot quot 42 quot Notice here that the argument comes along into the specification of the place When this happens the assignment operator will not try to create or assign a cell instead it will in this case call the method cell So quot cell quot quot 42 quot will ultimately end up being the same as quot cell quot quot 42 quot This way of transforming the name will work the same for all cases so you can have as many arguments as you want to the place on the left hand side The equals sign will be added to the method name and a message will be sent to that instead What happens here is a bit subtle Since the left hand side of the assignment takes arguments the amp quot amp quot method figures out that the assignment is not to a simple cell name but to a place The parsing step will change amp quot cell amp quot amp quot 42 amp quot into amp quot cell amp quot amp quot 42 amp quot Notice here that the argument comes along into the specification of the place When this happens the assignment operator will not try to create or assign a cell instead it will in this case call the method cell So amp quot cell amp quot amp quot 42 amp quot will ultimately end up being the same as amp quot cell amp quot amp quot 42 amp quot This way of transforming the name will work the same for all cases so you can have as many arguments as you want to the place on the left hand side The equals sign will be added to the method name and a message will be sent to that instead This makes assignment of places highly flexible and the only thing you need to do is implement methods with the right names This feature is used extensively in Lists and Dicts to make it easy to assign to specific indexes So say we have a list called x Then this code quot x 13 42 quot will be transformed into quot x 13 42 quot which will in turn be transformed into quot x 13 42 quot Ioke lists also has an at method so you can do quot x at 13 42 quot which will call at of course This makes assignment of places highly flexible and the only thing you need to do is implement methods with the right names This feature is used extensively in Lists and Dicts to make it easy to assign to specific indexes So say we have a list called x Then this code amp quot x 13 42 amp quot will be transformed into amp quot x 13 42 amp quot which will in turn be transformed into amp quot x 13 42 amp quot Ioke lists also has an at method so you can do amp quot x at 13 42 amp quot which will call at of course The second transformation that might happen is that if you try to assign a cell that has an assigner you will call that assigner instead of actually assigning a cell So for example if you do quot foo documentation 42 quot this will not actually create or assign the cell quot documentation quot Instead it will find that Base has a cell called quot documentation quot and instead send that message So the prior code would actually be equivalent to quot foo documentation 42 quot The second transformation that might happen is that if you try to assign a cell that has an assigner you will call that assigner instead of actually assigning a cell So for example if you do amp quot foo documentation 42 amp quot this will not actually create or assign the cell amp quot documentation amp quot Instead it will find that Base has a cell called amp quot documentation amp quot and instead send that message So the prior code would actually be equivalent to amp quot foo documentation 42 amp quot All of these assignment processes together make it really easy to take control over assignment while still making it very obvious and natural in most cases All of these assignment processes together make it really easy to take control over assignment while still making it very obvious and natural in most cases The easiest example of destructuring assignment looks like this The easiest example of destructuring assignment looks like this source lang ioke x y 42 44 source lt source lang quot ioke quot gt x y 42 44 lt source gt Note that the parenthesis are necessary both on the left hand and right hand side This will assign x to 42 and y to 44 in the current context following the assignment rules given above This assignment will happen in parallel which means you can do the obvious swapping of values in one operation Note that the parenthesis are necessary both on the left hand and right hand side This will assign x to 42 and y to 44 in the current context following the assignment rules given above This assignment will happen in parallel which means you can do the obvious swapping of values in one operation source lang ioke x y y x source lt source lang quot ioke quot gt x y y x lt source gt This also works for more than two simultaneous assignments This also works for more than two simultaneous assignments The right hand side of an expression like this is expected to be a regular value that can be converted into a tuple This include all Enumerable objects since asTuple is defined there That

    Original URL path: https://ioke.org/wiki/index.php?title=Guide:Assignment&diff=prev&oldid=400 (2016-02-13)
    Open archived version from archive

  • Guide:Aspects - IokeWiki
    anyFromSelf lt lt macro called call message name println source quot called call message name quot println lt source gt This code doesn t do anything strange at all This code doesn t do anything strange at all Next up we have after advice The only difference here is that after advice automatically gets a cell that is set to aspectResult that can be used inside the method Next up we have after advice The only difference here is that after advice automatically gets a cell that is set to aspectResult that can be used inside the method source lang ioke X after foo method args lt source lang quot ioke quot gt X after foo lt lt method args foo resulted in aspectResult println source quot foo resulted in aspectResult quot println lt source gt Remember that the result value of before and after advice doesn t count It is thrown away But these methods can still affect things by side effects They can also be used for validation A condition signalled inside of an advice would have the same effect as if done in the method itself namely interrupting the flow of control Remember that the result value of before and after advice doesn t count It is thrown away But these methods can still affect things by side effects They can also be used for validation A condition signalled inside of an advice would have the same effect as if done in the method itself namely interrupting the flow of control The final advice is around advice These are different in two ways First they get access to a cell called aspectCall which can be used to invoke the real cell and the next chain of advice of course The second difference is that the result of the around advice will be the return value from the cell So you can imagine the around advice executing instead of the original code If you forget to invoke it the original cell won t be invoked at all The final advice is around advice These are different in two ways First they get access to a cell called aspectCall which can be used to invoke the real cell and the next chain of advice of course The second difference is that the result of the around advice will be the return value from the cell So you can imagine the around advice executing instead of the original code If you forget to invoke it the original cell won t be invoked at all source lang ioke X around non existant method lt source lang quot ioke quot gt X around non existant lt lt method 42 42 X around foo method arg1 arg2 X around foo lt lt method arg1 arg2 before println quot before quot println res aspectCall arg2 arg1 res aspectCall arg2 arg1 got res println quot got res quot println 42 source 42 lt source gt The first piece of code show that you can actually

    Original URL path: https://ioke.org/wiki/index.php?title=Guide:Aspects&diff=prev&oldid=399 (2016-02-13)
    Open archived version from archive

  • Future plans - IokeWiki
    Ioke will be called Ioke F Exactly what it will contain we ll have to see but feel free to add your requests and ideas to Todo our TODO list I have many plans for the future of Ioke The next major version of Ioke will be called Ioke F Exactly what it will contain we ll have to see but feel free to add your requests and ideas to

    Original URL path: https://ioke.org/wiki/index.php?title=Future_plans&diff=prev&oldid=398 (2016-02-13)
    Open archived version from archive



  •