This library provides functions for creating and working with simple arrays.
Arrays are stored as a linear sequence of values. In memory, they are represented like:
+---+--------------------+ | 0 | number of elements | +---+--------------------+ | 1 | first value | +---+--------------------+ | 2 | second value | +---+--------------------+ | n | ... nth value ... | +---+--------------------+
( Create an array with four elements ) ^array'new{ 1 2 3 4 } constant a ( Add 10 to each element in an array ) a [ 10 + ] ^array'map ( Display an array ) a ^array'display ( Average the values in an array ) ^array'new{ 1 2 3 4 5 } [ ^array'sum ] [ ^array'length ] bi / ( Create an array of strings ) [ "abc" "def" "ghi" ] ^array'fromQuote
| Name | Stack | Usage |
|---|---|---|
| new{ | "-a | Create a new array. Parses and adds numbers to the array until "}" is reached. Returns a pointer to the new array. |
| display | a- | Display all values in the array |
| in? | na- | Returns -1 if value (n) is a value in the array |
| stringIn? | $n- | Returns -1 if string ($) is a string in the array |
| map | aq- | Apply quote to each item in the array. Updates the array with the values returned by the quote |
| apply | aq- | Apply quote to each item in the array. Does not modify the array contents. |
| sum | a-n | Add all values in an array |
| length | a-n | Get the number of items in an array |
| reverse | a- | Reverse the order of all elements in an array |
| append | aa-a | Append two arrays and return a new one |
| fromQuote | q-a | Generate an array from the values returned by a quote |
| toQuote | a-q | Generate a quote from the values stored in an array |
| sort:bubble | a- | Sort the items in an array using bubble sort |
This vocabulary provides support for testing code in a clean, predicatable manner.
Assertion predicates first check the stack for underflow; if the stack is deep enough, their embedded predicates are applied; if not, the assertion fails.
The result of each assertion - including the underflow check - is ANDed with the assertionFlag which can then be tested after the containing thread has finished executing; this is handled by the .assertion word class.
For custom behaviour, revector preCond and/or postCond; by default the pre-condition is an effective nop while the post- condition simply prints 'Success' or 'Failure'.
Given that each assertion predicate mutates assertionFlag, use of the word class .assertion is encouraged; this resets the assertionFlag before execution and push its final value to the stack before calling postCond when the thread exits.
NOTE: For simplicity of implementation, failure within a word of class .assertion will not result in immediate termination; instead, the false value of assertionFlag is left to propagate.
( Our assertions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) ( n.b, underflow is dealt with sanely ) : a1 ( xyz- ) 30 assert= 20 assert= 10 assert= ; assertion : a2 ( xy- ) assertTrue assertFalse ; assertion : a3 ( x- ) 5 assert< ; assertion ( Simple demo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) : go "\n----------" puts 10 20 30 a1 30 20 10 a1 "\n----------" puts 10 a1 "\n----------" puts a1 "\n----------" puts -1 0 a2 0 -1 a2 -1 -1 a2 -1 a2 "\n----------" puts 3 a3 4 a3 5 a3 a3 "\n----------" puts ; clear go ( Adjusting pre- and post- conditions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) : myPreCond .s ; : myPostCond [ "Fatal error: assertion failure." puts bye ] ifFalse ; &myPostCond is postCond &myPreCond is preCond ( 'go' will now exit on first failure ) go
| Name | Stack | Usage |
|---|---|---|
| assertionFlag | -a | Variable. This holds a true (-1) or false (0) value indicating whether the current set of assertions have passed or failed. The .assertion class will set this to true automatically. |
| assert | f- | Updates the assertionFlag using bitwise AND |
| available | n-f | Checks to see if there are at least n items on the stack. Returns true if there are, or false otherwise |
| assert= | nn- | Check to see if two values are equal |
| assertFalse | f- | Check to see if flag is false (0) |
| assertTrue | f- | Check to see if flag is true (non-zero) |
| assert> | nn- | Check to see if n1 is greather than n2 |
| assert>= | nn- | Check to see if n1 is greater than or equal to n2 |
| assert< | nn- | Check to see if n1 is less than n2 |
| assert<= | nn- | Check to see if n1 is less than or equal to n2 |
| putAssertion | f- | Display 'Success' or 'Failure' based on flag |
| preCond | - | Hook, does nothing bu default |
| postCond | f- | Hook, displays 'Success' or 'Failure' by default |
| .assertion | a- | Class handler for assertions |
| assertion | - | Change the class of a function to .asssertion |
The Ngaro virtual machine underlying Retro does not provide access to memory in units other than a standard cell. This simplifies things in many ways, but can be very wasteful of memory, especially when dealing with large amounts of text. This library provides support for dealing with byte-level access to the Ngaro memory.
byte: A unit of memory consisting of eight bits.
cell: A unit of memory consisting of thirty two bits.
needs bad'
1024 ^bad'newPool 'e 0 ^bad'b! 'f 1 ^bad'b! 'g 2 ^bad'b! 'h 3 ^bad'b! ^bad'pool @ putn 2 ^bad'b@ putn
| Function | Stack | Used For |
|---|---|---|
| pool | -a | Variable. This holds a pointer to the current byte addressable memory pool |
| unpack | c-bbbb | Given a byte-packed cell on the stack return the bytes it contains |
| pack | bbbb-c | Pack four byes into a cell, return the cell on the stack |
| b@ | a-b | Fetch a byte from the active byte addressable memory pool |
| b! | ba- | Store a byte into the currently active byte addressable memory pool |
| b@+ | a-ab | Fetch a byte from the active byte addressable memory pool. Returns next byte address and the byte fetched |
| b!+ | ba-a | Store a byte into the currently active byte addressable memory pool. Returns next byte address |
| newPool | n- | Allocate a new pool of n characters and set pool to point to it |
This library builds on the byte addressing vocabulary (bad') to provide support for creating and working with byte-packed strings.
Generally it's better to use the cell-based strings. They are larger in memory, but much faster to work with. If space is critical though, this library can be used to significantly reduce the memory consumed, at the cost of performance.
As an example of how this works, consider a simple string: "This is a test."
"This is a test."
Retro will create a string in memory that looks like:
0000 T 0001 h 0002 i 0003 s 0004 <space> 0005 i 0006 s 0007 <space> 0008 a 0009 <space> 0010 t 0011 e 0012 s 0013 t 0014 . 0015 <terminator>
So 16 cells used. If we byte pack this, it reduces considerably:
0000 This 0001 is 0002 a te 0003 st<terminator>
Down to four cells. It's a straightforward 4:1 reduction.
byte: A unit of memory consisting of eight bits.
cell: A unit of memory consisting of thirty two bits.
needs bstrings'
| Function | Stack | Used For |
|---|---|---|
| pack | $-a | Convert a standard string into a byte packed string |
| getLength | a-n | Return the length of a byte packed string (in characters) |
| unpack | a-$ | Convert a byte packed string into a standard string |
| withLength | a-an | Return the length (in characters) and address of a byte-packed string |
| puts | a- | Display a bye packed string |
| toLower | a-a | Convert a byte packed string to lowercase |
| toUpper | a-a | Convert a byte packed string to uppercase |
This vocabulary provides support for doing calculations involving time and dates.
| Function | Stack | Used For |
|---|---|---|
| MINUTES/WEEK | -n | Number of minutes in a week |
| MINUTES/DAY | -n | Number of minutes in a day |
| MINUTES/HOUR | -n | Number of minutes in an hour |
| HOURS/DAY | -n | Number of hours in a day |
| DAYS/WEEK | -n | Number of days in a week |
| DAYS/YEAR | -n | Number of days in a typical year |
| WEEKS/YEAR | -n | Number of weeks in a year |
| SECONDS/MINUTE | -n | Number of seconds in a minute |
| SECONDS/HOUR | -n | Number of seconds in an hour |
| SECONDS/DAY | -n | Number of seconds in a day |
| dayToName | n-$ | Convert the number of a day to a three letter abbreviation |
| daysPerMonth | m-n | Return the number of days in a given month |
| secondsPerMonth | m-n | Return the number of seconds in a given month |
| isLeapYear? | y-f | Return true (-1) if the year is a leap year or false (0) otherwise |
| secondsPerYear | y-n | Return the number of seconds in a given year |
| toJulian | dmy-j | Convert a date into a Julian day |
| toDayOfWeek | dmy-n | Convert a date to the numeric day of the week |
This library provides support for the canvas device provided by the JavaScript implementation of Ngaro.
Since the JavaScript implementation has no file I/O, build an image with this loaded manually.
needs infix' include vm/web/dumpImage.rx
100 100 50 ^canvas'red ^canvas'solid ^canvas'circle
| Name | Stack | Usage |
|---|---|---|
| mouse | -xy | Current mouse coordinates |
| click? | -f | Is mouse button clicked? |
| setColor | c- | Set color to c. Used by various other words |
| pixel | xy- | Draw a pixel in the current color |
| solid | - | Modifier; tells box and circle to draw a filled in shape rather than an outline |
| box | xyhw- | Draw a box |
| vline | xyh- | Draw a vertical line |
| hline | xyw- | Draw a horizontal line |
| circle | xyw- | Draw a circle |
| black | - | Set color |
| blue | - | Set color |
| green | - | Set color |
| cyan | - | Set color |
| red | - | Set color |
| purple | - | Set color |
| brown | - | Set color |
| gray | - | Set color |
| darkGray | - | Set color |
| brightBlue | - | Set color |
| brightGreen | - | Set color |
| brightCyan | - | Set color |
| brightRed | - | Set color |
| magenta | - | Set color |
| yellow | - | Set color |
| white | - | Set color |
| dimensions | -hw | Return height and width of canvas |
Casket is a lightweight framework intended to simplify the development of web apps in Retro.
Casket grew out of my work on the Corpse blog and later through work on the Rancid IRC log viewer.
| Name | Stack | Usage |
|---|---|---|
| serve: | """- | Serve a file with a specific mime type |
| decode | $- | Decode a URL encoded string |
| dispatch | - | Look for a view handler (e.g., /index) and call it, or call /404 if none is found |
| doBeforeDispatch | - | Code to execute before processing paths. This is always called before dispatch. |
| / | - | Default index page |
| /404 | - | Default 404 error page |
| withTemplate | $- | Include and render a template file using the tputs function |
| withFile | $- | Include and render a raw file |
| tputs | ...$- | This is a replacement for puts, which adds additional escape sequences for use with the templates. |
| eputs | $- | This is a replacement for puts, which escapes html entities for use with
 and such |
| Content-type: | "- | Generate a MIME header for a file or view |
| getFormData | -$ | Process a form and return the elements as a text string |
| getRequest | - | Internal: Read the PATH_INFO environment variable and parse for casket:path and casket:options |
| casket:url | -a | Function returning application url |
| casket:root | -a | Function returning path to application root |
| casket:form | -a | Internal buffer for form data |
| casket:buffer | -a | Internal buffer |
| casket:options | -a | Returns optional data following view) |
| casket:path | -a | Returns requested view (e.g., /index) |
needs casket' with casket' : /index Content-type: text/html "index.erx" withTemplate ; : /test Content-type: text/html casket:options "test.erx" withTemplate ; [ ( -$ ) "/path/to/app/" ] is casket:root [ ( -$ ) "http://domain.ext/path/to/cgi" ] is casket:url &/index is / &dispatch is boot save bye

Test of Casket

test apple or test banana.

" tputs
You requested...

An %s.

This library provides a vocabulary for simple operations on ASCII characters.
The following should suffice:
needs char'
97 ^char'isChar? 'a dup ^char'isUpper? [ ^char'toLower ] ifTrue
| Name | Stack | Usage |
|---|---|---|
| isChar? | c-f | Return true if a given value is an alphabetic character (A-Z or a-z). If not, return false |
| isUpper? | c-f | Return true if character is uppercase, false otherwise |
| isLower? | c-f | Return true if character is lowercase, false otherwise |
| isNumeric? | c-f | Return true if character is between 0 - 9 inclusive, or false otherwise |
| isWhitespace? | c-f | Return true if character is a space, tab, or end of line. Returns false otherwise |
| isVisible? | c-f | Return true if character is visible, or false if it is a control-type character |
| toUpper | c-c | Convert a lowercase character to uppercase. This will only work on a lowercase character. |
| toLower | c-c | Convert an upperacase character to lowercase. This will only work on an uppercase character. |
| toString | c-$ | Convert a character into a string |
This library serves as a home to various combinators that are useful, but not essential to the core Retro language.
needs combinators'
| Function | Stack | Used For |
|---|---|---|
| loopd | seq- | Execute a loop. Index starts at high value (e) and decrements to low value (s). The loop body is quote (q). |
| indexd | -n | Return the current index for a decrementing loop. |
| loopi | seq- | Execute a loop. Index starts at low value (s) and increments to high value (e). The loop body is quote (q). |
| indexi | -n | Return the current index for an incrementing loop. |
| Function | Stack | Notes |
|---|---|---|
| colors | -a | Variable; indicates if console exists |
| esc | $- | Display a string starting as an escape sequence |
| at-xy | xy- | Move cursor to x,y |
| home | - | Move cursor to top left corner |
| black | - | Set foreground color |
| onBlack | - | Set background color |
| red | - | Set foreground color |
| onRed | - | Set background color |
| green | - | Set foreground color |
| onGreen | - | Set background color |
| yellow | - | Set foreground color |
| onYellow | - | Set background color |
| blue | - | Set foreground color |
| onBlue | - | Set background color |
| magenta | - | Set foreground color |
| onMagenta | - | Set background color |
| cyan | - | Set foreground color |
| onCyan | - | Set background color |
| white | - | Set foreground color |
| onWhite | - | Set background color |
| normal | - | Reset colors to default |
| bold | - | Set color attribute to bold/bright |
| dimensions | -hw | Return height and width of console |
I enjoy dabbling with logic puzzles and classical forms of encryption. This vocabulary is intended to be a tool to help with these diversions.
| Name | Stack | Usage |
|---|---|---|
| ceaser | $n-$ | Encrypt (or decrypt) a string using the ceaser algorithm. The value n is the number of characters to shift the alphabet by. |
| rot13 | $-$ | Encrypt or decrypt a string using rot13. This is a trivial variant of the ceaser algorithm. |
| tapcode:encrypt | $-a | Encrypt a string into a tapcode array |
| tapcode:decrypt | a-$ | Decrypt a tapcode array into a string |
| pigpen:encrypt | $-a | Convert a string into a pigpen encoded array. To display the pigpen sequence, try: "ab" ^crypto'toPigpen [ puts space ] ^array'apply |
| pigpen:decrypt | a-$ | Decode a pigpen encoded array into a string |
| keyword:setKey | $- | Set the key to use for keyword encryption. This should be 26 characters long. |
| keyword:encrypt | $-$ | Encrypt a string using keyword encryption |
| keyword:decrypt | $-$ | Decrypt a string using keyword encryption |
This vocabulary provides a prefix and some functions for working with simple decimal values. It's not intended as a replacement for fixed or floating point math.
| Function | Stack | Usage |
|---|---|---|
| __d | "-n | Prefix to parse a value like "nn.nnn" into an integer |
| putn | n- | Display a decimal number, based on scale |
| scale | -a | Variable containing the number of decimal places |
| split | -n | Return a factor to divide by for display/working with decimal values |
The core Casket framework provides minimal templating, but no easy way to generate HTML from code.
This vocabulary provides support for generating HTML using a series of combinators. Textual data returned will be displayed (using ^casket'tputs), and various attributes are supported.
needs decompose'
: /index Content-type: text/html [ [ [ "Hello" ] title ] head [ [ "Welcome" ] h1 [ "This is a paragraph." ] p ] body ] html ;
A decorator extends an existing function by appending ocde that will be executed before (and possibly after) execution of the original function.
ok : foo + putn cr ; ok 1 ok 2 ok foo 3 ok : demo 2over "%d + %d = " puts ; ok &foo ok &demo ok decorate ok 1 ok 2 ok foo 2 + 1 = 3 ok
| Name | Stack | Usage |
|---|---|---|
| decorate | aa- | Apply decoration (a2) to function (a1) |
| undecorate | a- | Remove a decoration from a function |
This library reduces overall memory consumption by reducing the string length and number of string buffers.
While easy enough to do manually, this automates the process and makes it easily reversible.
After loading, add a call to the function desired to your application code. E.g.,
[ ^diet'extreme ] is boot
| Name | Stack | Usage |
|---|---|---|
| shrink | - | Reduce string length. This is invoked during the initial load of the library |
| extreme | - | Further reductions of string length and reduces the buffers |
| max | - | Shrink as far as possible. Disables hidden headers and temporary strings |
| bloat | - | Restore buffers and string length to the default |
This vocabulary provides a basic decompiler for the Ngaro instruction set.
| Name | Stack | Usage |
|---|---|---|
| lookupOpcode | n-$ff | |
| decompile | a-a$ | |
| endOfWord? | a-f |
This vocabulary adds support for enumerated values.
0 enum A enum B enum C enum D drop
Or
0 enum| A B C D |
| Function | Stack | Usage |
|---|---|---|
| step | n-n | Increment for next enumerated value. Defaults to 1+ but can be revectored as needed |
| enum | n"-n | Create an enumerated constant, and increment the value using step |
| enum| | n"- | Create a series of enumerated values, incremented by step |
This library provides a vocabulary for evaluating code contained in strings.
Retro was not designed to allow textual strings to be evaluated. This works by remapping the keyboard input to read from a string, until the string is exhausted. Additionally, it has a built-in varient of the listener to process input immediately, rather than after the function returns.
This library should be used only if there's no other (clean) way to solve a problem.
The following should suffice:
needs eval'
: foo ( -n ) 99 "54 + putn" ^eval'eval 5 ; ^eval'ifNotDefined foo { 100 constant foo } ^eval'ifDefined foo { foo 10 * putn }
| Function | Stack | Description |
|---|---|---|
| eval | $- | Evaluate a string |
| ifDefined | ""- | Parse for a name, if found, execute code in the following string block. Otherwise ignore the string block. |
| ifNotDefined | ""- | Parse for a name, if not found, execute code in the following string block. If found, ignore the string block. |
I have always enjoyed playing interactive fiction games. This library provides a framework for building simple games of this type. It's been used for an implemention of Cloak of Darkness, as well as various small puzzle games for my children.
| Name | Stack | Usage |
|---|---|---|
| ROOM | -n | Item type for rooms |
| ITEM | -n | Item type for items |
| .description | a-a | Object field. Describe the item |
| .shortDescription | a-a | Object field. Short name for object |
| .type | a-a | Object field. Type. ROOM or ITEM |
| .onLook | a-a | Object field. Custom handler for "look" |
| .onEntry | a-a | Object field. Custom handler for entry event |
| .location | a-a | Object field. Where is this object? |
| .visited | a-a | Object field. Have we been here before? |
| .toNorth | a-a | Object field. Pointer to location to the north |
| .toSouth | a-a | Object field. Pointer to location to the south |
| .toEast | a-a | Object field. Pointer to location to the east |
| .toWest | a-a | Object field. Pointer to location to the west |
| .onNorth | a-a | Object field. Custom handler for "north" |
| .onSouth | a-a | Object field. Custom handler for "south" |
| .onEast | a-a | Object field. Custom handler for "east" |
| .onWest | a-a | Object field. Custom handler for "west" |
| .postDescription | a-a |
|
| .preDescription | a-a |
|
| .onRead | a-a | Object field. custom handler for "read" |
| describes | $"- | Add a description to an object |
| nameOf | $"- | Specify a short name for an object |
| room | "- | Create a new ROOM object |
| invertDirection | a$-a | |
| is | a""""- | |
| items | -L | Linked list of all known items |
| item | "- | Create a new ITEM object |
| contains | a"- | Mark that a room contains an item |
| has? | a-af | Does the player have an item? |
| displayItem | a- | Display the name of an item |
| inventory | - | Display all items the player has |
| Function | Stack | Notes |
|---|---|---|
| :R | -n | Mode for reading a file. Does not create file |
| :W | -n | Mode for writing a file |
| :A | -n | Mode for appending to a file |
| :M | -n | Mode for modifying a file. Does not create file. |
| open | $m-h | Open a file. Will return a handle. Valid handles will be non-zero. A zero handle indicates failure to open a file. |
| read | h-c | Read a byte from a file. This returns the byte. |
| write | ch-f | Write a byte to a file. This returns a flag indicating the number of bytes written. (Should always equal '1') |
| close | h-f | Close an open file. Returns a flag of zero if unable to close, or non-zero if successful. |
| pos | h-n | Get current position in a file |
| seek | nh-f | Seek a position in a file |
| size | h-n | Return size of open file |
| delete | $-f | Delete a file. Returns a handle. Non-zero if successful, zero if failed. |
| slurp | a$-n | Read a file into a buffer |
| spew | an$-n | Write (n) bytes from address (a) into a file |
| readLine | h-$ | Read a line from a file |
| writeLine | $h- | Write a string to a file |
This vocabulary will make Retro closer to a traditional Forth system. When it is visible, some things will be significantly different than in a standard Retro system, but it will also be easier to port existing Forth code.
Eventually this should provide a large subset of the ANS Forth standard, with the limitation that only lowercase function names are provided.
Strings in ANS Forth are represented either as counted, or address and length pairs.
This differs from the strings in Retro which are represented as null-terminated character arrays. So existing functions can't be directly used with strings created by the functions this vocabulary provides, and these functions can not be used freely with Retro strings.
For counted strings, you get a pointer to a structure in memory that looks like:
length,characters
These can be unpacked into address/length pairs using count.
| Function | Stack | Usage |
|---|---|---|
| if | f- | Start a conditional sequence |
| else | - | Start the second half of a conditional sequence |
| then | - | End a conditional sequence |
| 0< | n-f | Return true flag if n is less than zero |
| 0= | n-f | Return true flag if n is equal to zero |
| for | n- | Start a counted loop |
| next | - | End a counted loop |
| r@ | -n | Return a copy of the top item on the address stack |
| >r | n- | Push a value to the address stack |
| r> | -n | Pop a value off the address stack |
| 2dup | xy-xyxy | Duplicate the top two items on the stack |
| emit | c- | Display a character |
| key | -c | Read a keypress |
| type | an- | Display n characters from string |
| spaces | n- | Display a series of spaces |
| state | -a | Same as compiler |
| ['] | "-a | Return the address of a function. Compile-time version of ' |
| recurse | - | Compile a call to the current function into the function |
| */mod | abc-rq | Multiply a by b, then divide the results by c. Returns the remainder and the quotient. |
| rshift | ab-c | Shift bits right |
| lshift | ab-c | Shift bits left |
| fm/mod | ab-mq | Floored divide and remainder |
| sm/mod | ab-mq | Symmetric divide and remainder |
| c" | "-a | Parse and return a counted string |
| s" | "-an | Parse and return a string and its length |
| count | a-an | Convert a counted string to an addr/len pair |
| [ | - | Turn compiler off |
| ] | - | Turn compiler on |
| char | "-c | Parse for and return an ASCII character |
| [char] | "-c | Compile-time version of char |
| lateBinding | $- | "on" binds names to functions after execution of ;, "off" binds immediately |
| pick | ...n-..m | Evil function to access arbitrary stack items |
| roll | xu xu-1 ... x0 u -- xu-1 ... x0 xu | Remove u. Rotate u+1 items on the top of the stack |
This library provides a vocabulary for generating hashes from strings.
Most documented hash functions leverage unsigned longs during computation. Here we use signed cells as unsigned words are not offered by Retro at the present time. So that we avoid returning negative hash values, hashing is filtered through abs. (Negative values emerge due to shifting into the sign bit.)
The hash-prime variable has been selected to provide a reasonable balance between clashing and key size -- this is to ensure that associative arrays built using hash don't need to allocate too much heap. This can be adjusted by revectoring hash in the [unlikely] event of large tables.
The following should suffice:
needs hash'
needs hash' "hello" ^hash'hash
| Name | Stack | Usage |
|---|---|---|
| djb2 | $-n | Generate a djb2 hash. This is the default option. |
| hash | $-n | Generate a hash from a string. Normally this is all you need to use. |
| Name | Stack | Usage |
|---|---|---|
| hash-prime | -a | Prime used by hashing algorithim |
This library provides a vocabulary for supporting simple infix math.
Expressions are processed from left to right.
The following should suffice:
needs infix'
with infix' 1 + 2 putn 4 * 2 + 3 putn
| Name | Stack | Usage |
|---|---|---|
| + | ( x"-y ) | 1 + 2 |
| - | ( x"-y ) | 2 - 1 |
| * | ( x"-y ) | 3 * 3 |
| / | ( x"-y ) | 4 / 2 |
| mod | ( x"-y ) | 5 % 2 |
| /mod | ( x"-qr ) | 5 /mod 2 |
| ^ | ( x"-n ) | 5 ^ 2 |
This vocabulary provides functions for examining functions and data structures.
| Function | Stack | Usage |
|---|---|---|
| isRevectorable? | a-f | Returns -1 if a function can be revectored, or 0 if not. |
| isVisible? | a-f | Returns -1 if a function is visible in the current dictionary, or 0 if not |
| getClass | a-a | Return the class of a function, or 0 if not found |
| startOfBuffers | -a | Address where system buffers begin |
| reserved | -n | Amount of memory used for buffers |
| freeSpace | -n | Amount of free space (between here and startOfBuffers |
While linked lists are a simple data structure, they are very useful. This vocabulary provides a foundation for creating and using them in a predicatable, consistent way.
The linkedList' vocabulary provides support for single linked lists.
In this form a list consists of a series of nodes that each point to the prior node. The list pointer variable is updated with each add or remove to point to the newest node in the chain.
^linkedList'new: L
100 L ^linkList'add
L ^linkList'remove
10 L ^linkList'nth
| Name | Stack | Usage |
|---|---|---|
| node | "- | Structure for list nodes |
| .prior | a-a | Access prior node field |
| .value | a-a | Access value field |
| new: | "- | Create a list. This gives a variable pointing to a node structure |
| add | nL- | Add a value to a list. Allocates a new node |
| remove | L-n | Remove a node from a list and return its value |
| addNode | NL- | Add a node to a list |
| removeNode | L-N | Remove a node from a list. Returns the node |
| nth | nL-N | Return the nth node from the list. Indexing starts at 1. |
This library provides support for additional mathmatic operations not provided by the core Retro language.
| Function | Stack | Description |
|---|---|---|
| squareRoot | x-n | Find an (approximate) square root for a given value |
| gcd | xy-n | Find the greatest common denominator for two values |
| lcm | xy-n | Find the least common multiplier for two values |
| divisor? | ab-f | Tests to see if b is a divisor of a. Returns a flag. |
| */ | abc-d | Multiply a by b, then divide bye c to get d |
| even? | n-f | Returns a flag indicating whether or not a number is true |
| odd? | n-f | Returns a flag indicating whether or not a number is false |
| pow | bp-n | Raise (b) to power (p) |
| abs | n-n | Absoulte value of number (n) |
| min | ab-c | Minimum of (a) or (b) |
| max | ab-c | Maximum of (a) or (b) |
| random | -x | Return a random number |
This library provides symbolic constants and helper functions for using the VM queries in a clean, portable manner.
| MEMORY-SIZE | -n | Query for determining amount of memory provided by the virtual machine |
| CANVAS? | -n | Query for determining whether the virtual machine provides a canvas device |
| CANVAS-WIDTH | -n | Query returning canvas width |
| CANVAS-HEIGHT | -n | Query returning canvas height |
| STACK-DEPTH | -n | Query returning data stack depth |
| ADDRESS-STACK-DEPTH | -n | Query returning address stack depth |
| MOUSE? | -n | Query for determining if the virtual machine provides a mouse device |
| TIME | -n | Query returning current time in seconds |
| QUIT-VM | -n | Query to shutdown the virtual machine |
| HOST-ENVIRONMENT-QUERY | -n | Query to lookup and return the value of an environment variable in the host system |
| CONSOLE-WIDTH | -n | Query returning the console width |
| CONSOLE-HEIGHT | -n | Query returning the console height |
| BITS-PER-CELL | -n | Query returning the number of bits in a cell |
| ENDIAN | -n | Query returning a flag which indicates endian used by the virtual machine |
| CONSOLE? | -n | Query to see if enhanced text console is provided |
| query | ?-? | Perform a query. Actual stack effect varies by query |
This library provides a vocabulary for creating and using custom LIFO stacks.
The following should suffice:
needs stack'
with stack' new: foo 100 push 200 push new: bar 300 push 400 push 500 push depth putn pop putn foo set depth putn pop putn pop putn bar set pop putn pop putn
| Name | Stack | Usage |
|---|---|---|
| get | -a | Get address of current stack |
| set | a- | Activate a stack |
| new | - | Create a new anonymous stack |
| new: | "- | Create a new named stack |
| push | n- | Push a value to a stack |
| pop | -n | Pop a value from a stack |
| depth | -n | Return number of items on stack |
This vocabulary provides support for creating and using simple data structures.
with struct' { 1 field .id 4 field .initials 1 field .jobcode } employee ( The above could also be written as: ) { 3 fields .id 4 .initials .jobcode } employee employee Fred 1 Fred !.id "fjh" Fred .initials 3 copy 22 Fred !.jobcode employee Sue 2 Sue !.id "sjs" Sue .initials 3 copy 91 Sue !.jobcode Fred @.id putn Sue @.id putn Sue .initials puts
| Name | Stack | Used for |
|---|---|---|
| { | -n | Start a new structure |
| field | nn"-n | Add a field to a structure. Takes the number of cells to allocate and parses for a name |
| fields | n"-n | Add multiple fields to a structure. Takes the number of fields and parses for names and optionally sizes. |
| } | n"- | End a structure. Parses for the structure name |
| size | a-n | Return the size of a structure. The address must be the address of the function created by }, not the actual allocated structure. |
| clone | a-a | Given a structure address, return a new anonyous instance |
This library provides functions for accessing 16-bit and 8-bit subsets of cells.
| Function | Stack |
|---|---|
| highWord | cellAddr -- highwordAddr |
| lowWord | cellAddr -- lowwordAddr |
| w@ | wordAddr -- val |
| w@+ | wordAddr -- wordAddr val |
| w! | val wordAddr -- |
| w!+ | val wordAddr -- wordAddr+1 |
| highByte | wordAddr -- highbyteAddr |
| lowByte | wordAddr -- lowbyteAddr |
| c@ | byteAddr -- val |
| c@+ | byteAddr -- byteAddr val |
| c! | val byteaddr -- |
| c!+ | val byteAddr -- byteAddr+1 |
| highNibble | byteAddr -- highnibbleAddr |
| lowNibble | byteAddr -- lownibbleAddr |
| nibble@ | nibbleAddr -- val |
| nibble@+ | nibbleAddr -- nibbleAddr val |
| nibble! | val nibbleAddr -- |
| nibble!+ | val nibbleAddr -- nibbleAddr+1 |
| packString | strAddr -- |
| printPack | strAddr -- |
| getPackedLength | strAddr -- strLen |
This vocabulary will provide support for creation and use of unsigned values.
A value is a variable that returns the stored value when used. This library provides an implementation for Retro.
The following should suffice:
needs values'
with values' value foo 100 to foo foo foo + .s 50 to foo foo foo + .s
| Name | Stack | Usage |
|---|---|---|
| .value | a-n
or
na-
|
Return a stored value
Update a stored value
|
| to | `- | Switch value to update mode |
| value | "- | Create a new value |
This library provides some functions for determining the differences between VM implementations and conditionally evaluating code blocks based on these differences.
Specifically, it provides functions for determining the number of bits per cell and the endian nature of an implementation.
| Function | Stack | Usage |
|---|---|---|
| size | -n | Return the number of bits per cell |
| endian | -n | Return 0 for little endian or 1 for big endian |
| bits{ | n"- | Execute code up to } if the bits per cell matches n |
| bigEndian | "- | Execute code up to } if endian is big |
| littleEndian | "- | Execute code up to } if endian is little |
| } | - | Does nothing |


Project Network
Home
Recovery
External Router
Internal Router
Web Server
DNS Server
About
Project Network
Web Server


AAP Minister Stokes Controversy, Says 'Lord Krishna & Ram Have no Historical Proof'
by Suchitra KarthikeyanPolitics
Stoking a major religious controversy, AAP's Social welfare minister Rajendra Pal Gautam, on Thursday, has stated Lord Krishna, Ram have no historical proof
Written By Suchitra Karthikeyan | Mumbai | Updated On: November 22, 2019 10:29 IST
Stoking a major religious controversy, AAP leader and Delhi's Social welfare minister Rajendra Pal Gautam, on Thursday, has stated that Lord Krishna, Ram have no historical proof, while commenting on Swami Ramdev Baba's tweet. He stated that Lord Krishna and Ram found no mention in history textbooks, only in mythology. He added that as Periyar's ideology was found in history texts, it was based on reason and authenticity. He has now deleted the tweet.
AAP minister says 'Lord Ram and Krishna' have no historical proof
WATCH | Ramdev comes out in support of NRC, says it will 'weed' out threats from country
Ramdev Baba defends Periyar statement:
Previously in a tweet, Yoga guru Ramdev Baba had stated that anyone who respected one's ancestors Lord Ram and Lord Krishna they will defend them. Citing leaders like Ambedkar, Jyotiba Phule, Savitribai Phule, and others, he said that he respected them a lot. But as renowned socialist and 'Father of the Dravidian movement' Periyar's ideologies were against mythology, he stated that he felt the need to defend them.
WATCH: Baba Ramdev performs the most complex Yoga asanas with ease
DMK condemns Baba Ramdev's Periyar
Ramdev Baba's statements on Periyar had also gotten a sharp reply from DMK chief M K Stalin, who has coem out in defence of the DMK's founding father. He condemned the attack and stated that he will defend Dravidian ideology against such forces. Ramdev Baba has since then clarified that he has not insulted major Dalit leader B R Ambedkar and respects him.
“I strongly condemn this targeted attack on Periyar and our ideology by right-wing forces. The DMK will defend the Dravidian ideology against all such oppressive forces,” Stalin said in a tweet.
READ | Baba Ramdev on National Herald piece: 'Congress has shown its culture'
Who is Periyar?
Known as the 'Father of the Dravidian movement', Periyar E. V. Ramasamy was an Indian social activist and politician who started the Self-Respect Movement and Dravidar Kazhagam. Striving for equality in society, he worked against Brahminical dominance, caste prevalence and women oppression in Tamil Nadu. After initially being in Congress, he split to found the Dravidar Kazhagam in 1944. The party later split with one group led by C. N. Annadurai forming the Dravida Munnetra Kazhagam (DMK) in 1949 and the other the AIADMK - founded by M. G. Ramachandran in 1972 breaking away from DMK itself.
READ | Baba Ramdev hails PM Modi's political will on Art 370, Ayodhya verdict


Menu
Bar
The
Menu Bar contains the following pull-down menus:
The File menu contains commands which allow you
to process text files containing large numbers of coordinates, or to exit the
program.
The Open command allows you to select a text file
containing coordinates to be processed. It begins the file processing dialog by
bringing up a standard File Open dialog box that you can use to select the file
to be read. For more information, see the descriptions of File Processing, or
of the File Processing user interface.
The Create File Header command allows you to
create a coordinate file header for a specified datum and coordinate reference
system, along with any associated parameters. It begins the input file header
generation dialog by bringing up the Create File Header window, which is
identical to the lower half of the File Processing window.
The Load Settings command allows you to set the current
format options, input and output datum selections, input and output coordinate
reference system selections, and any associated parameter values, to the
settings previously stored in the settings file, which is located in the data
directory.
The Save Settings command allows you to save the
current format options, input and output datum selections, input and output
coordinate reference system selections, and any associated parameter values, to
the settings file, which is located in the data directory.
The Exit command
immediately terminates the application, causing the main window to disappear.
The Edit menu contains conventional text editing
commands which allow you to cut, copy, and paste text into and out of text
fields in the interface.
The Cut command allows you to cut text out of
text fields in the interface and save it to the clipboard.
The Copy command allows you to copy text out of
text fields in the interface and save it to the clipboard.
The Paste command allows you to paste text into
text fields in the interface from the clipboard.
The Options menu contains commands that allow
you to control the format and precision in which output coordinate values are
displayed, as well as the look and feel of the interface itself. Newly selected
format options take effect when the Convert button is pressed, or when the
Input or Output coordinate reference system selection is changed.
The Format… command
causes a tabbed dialog box to appear. This dialog box has tabs for Number
Format and Precision. The Number Format tab provides sets of radio buttons
corresponding to the Geodetic Units, Geodetic Separator, Sign/Hemisphere,
The Geodetic Units command provides a set of
options that allow you to control the angular units in which output geodetic coordinates
are displayed. The format in which geodetic coordinates are displayed is also
affected by the setting of the Precision option. For example, if the Geodetic
Units option is set to Degrees/Minutes/Seconds, but the Precision option is set
to 1 minute, no seconds subfield will be displayed. Geodetic coordinates may be
input using any variation, or combination of variations, of the supported
formats.
This option causes output geodetic coordinates
to be displayed in degrees, minutes, and seconds format, i.e., DDD MM SS.FF.
This option causes output geodetic coordinates
to be displayed in degrees and minutes format, i.e., DDD MM.FFFF.
This option causes output geodetic coordinates
to be displayed in decimal degrees format, i.e., DDD.FFFFFF.
The Geodetic Separator command provides a set of
options that allow you to control the character used to separate the degree,
minutes, and seconds subfields when output geodetic coordinates are displayed.
Geodetic coordinates may be input using any of the supported separator
characters.
This option causes the degrees, minutes, and
seconds subfields of output geodetic coordinates to be separated by a blank
space (' ').
This option causes the degrees, minutes, and
seconds subfields of output geodetic coordinates to be separated with a slash
('/').
This option causes the degrees, minutes, and
seconds subfields of output geodetic coordinates to be separated with a colon
(':').
The Sign / Hemisphere command provides a set of
options which allow you to control the way in which the sign or hemisphere of
output geodetic coordinates is displayed. Geodetic coordinates may be input
using either of the supported methods of specifying sign or hemisphere.
This option causes output geodetic coordinates
to be displayed with a minus sign('-') as a prefix when their values are
negative. No sign is displayed when their values are positive.
This option causes output geodetic coordinates
to be displayed with a hemisphere letter ('N' or 'S' for latitude, 'E' or 'W'
for longitude) as a suffix.
The
This option causes output geodetic longitude
values to be displayed in the range from-180˚ to +180˚.
This option causes output geodetic longitude
values to be displayed in the range from 0˚ to 360˚.
The Precision command provides a set of options
that allow you to control the precision with which output coordinates are
displayed, ranging from 1 meter (or.01 second) to 100,000 meters (or 1 degree).
GEOREF, MGRS, and USNG coordinates are truncated, while all other coordinate
values are rounded. In general, you should use the Precision option that
matches the precision or accuracy of your input data, whichever is worse. If no
Precision option exactly matches this value, use the next better precision. For
example, if your source data looks like "20 55 44.22N, 55 55 42.86E",
with an average error of 0.2 seconds, use the 0.1 second Precision option. If
your data looks like "20 55N, 55 55E", and is accurate to one minute,
use the 1 minute Precision option.
This option causes output coordinates to be
displayed rounded (or truncated) to the nearest 100,000 meters (for Easting/X,
Northing/Y, Z, and Ellipsoidal Height values) or to the nearest 1 degree (for
Latitude and Longitude values).
This option causes output coordinates to be
displayed rounded (or truncated) to the nearest 10,000 meters (for Easting/X,
Northing/Y, Z, and Ellipsoidal Height values) or to the nearest 10 minutes (for
Latitude and Longitude values).
This option causes output coordinates to be
displayed rounded (or truncated) to the nearest 1,000 meters (for Easting/X,
Northing/Y, Z, and Ellipsoidal Height values) or to the nearest 1 minute (for
Latitude and Longitude values).
This option causes output coordinates to be
displayed rounded (or truncated) to the nearest 100 meters (for Easting/X,
Northing/Y, Z, and Ellipsoidal Height values) or to the nearest 10 seconds, 0.1
minutes, or 0.001 degrees, as appropriate (for Latitude and Longitude values).
This option causes output coordinates to be
displayed rounded (or truncated) to the nearest 10 meters (for Easting/X,
Northing/Y, Z, and Ellipsoidal Height values) or to the nearest 1 second, 0.01
minutes, or 0.0001 degrees, as appropriate (for Latitude and Longitude values).
This option causes output coordinates to be
displayed rounded (or truncated) to the nearest 1 meter (for Easting/X,
Northing/Y, Z, and Ellipsoidal Height values) or to the nearest 0.1 second,
0.001 minutes, or 0.00001 degrees, as appropriate (for Latitude and Longitude
values).
This option causes output coordinates to be
displayed rounded (or truncated) to the nearest 0.1 meter (for Easting/X,
Northing/Y, Z, and Ellipsoidal Height values) or to the nearest 0.01 second,
0.0001 minutes, or 0.000001 degrees, as appropriate (for Latitude and Longitude
values). A warning is displayed whenever this precision level is selected,
because the software has not been tested to the level of accuracy that the
additional displayed digits imply.
This option causes output coordinates to be
displayed rounded (or truncated) to the nearest 0.01 meter (for Easting/X,
Northing/Y, Z, and Ellipsoidal Height values) or to the nearest 0.001 second,
0.00001 minutes, or 0.0000001 degrees, as appropriate (for Latitude and
Longitude values). A warning is displayed whenever this precision level is
selected, because the software has not been tested to the level of accuracy
that the additional displayed digits imply.
This option causes output coordinates to be
displayed rounded (or truncated) to the nearest 0.001 meter (for Easting/X,
Northing/Y, Z, and Ellipsoidal Height values) or to the nearest 0.0001 second,
0.000001 minutes, or 0.00000001degrees, as appropriate (for Latitude and
Longitude values). A warning is displayed whenever this precision level is
selected, because the software has not been tested to the level of accuracy
that the additional displayed digits imply.
This option toggles
the display of leading zeros in output geodetic coordinates. When it is
selected, leading zeros are displayed in the degree, minute, and second fields
of all geodetic coordinates.
The Look and Feel
command provides a set of options that allow you to control the general
appearance of the application GUI.
This option causes the
GUI to have the default Java look and feel.
This option causes the
GUI to have the look and feel of a Motif user interface.
This option causes the
GUI to have the look and feel of a Windows user interface.
The Datum menu contains commands that allow you
to create and delete user-defined datums.
The Create Datum command allows you to create a
new user-defined 3-parameter or 7-parameter datum. It opens the Create
Datum dialog box where you can specify the code, name, and parameters for a
new user-defined datum.
The Delete Datum command allows you to delete a
previously created user-defined datum. It opens the Delete
Datum dialog box where you can select the user-defined datum to be deleted.
The Ellipsoid menu contains commands that allow
you to create and delete user-defined ellipsoids.
The Create Ellipsoid command allows you to create
a new user-defined ellipsoid. It opens the Create
Ellipsoid dialog box where you can specify the code, name, and parameters
for a new user-defined ellipsoid.
The Delete Ellipsoid command allows you to
delete a previously created user-defined ellipsoid. It opens the Delete
Ellipsoid dialog box where you can select the user-defined ellipsoid to be
deleted.
The Convert menu
contains commands that allow you to convert coordinates.
The Convert Upper to
Lower command allows you to convert the coordinates in the upper half of the
window to the coordinate reference frame specified in the lower half of the
window, outputting the results to the lower coordinate fields. Its effect is exactly the same as that of the
Convert: Upper to Lower button.
The Convert Lower to
Upper command allows you to convert the coordinates in the lower half of the
window to the coordinate reference frame specified in the upper half of the
window, outputting the results to the upper coordinate fields. Its effect is exactly the same as that of the
Convert: Lower to Upper button.
The Help menu contains commands that provide you
with additional information about the GEOTRANS application and its operation.
The Contents command allows you access to the
on-line help.
The About… command provides version information
for the GEOTRANS application.


{% extends 'master-installer.html' %} {% load static widget_tweaks %} {% block content %}
Are you sure to reset this global configuration?


{% extends "admin/admin_base.html" %} {% load static %} {% block header %} {% endblock %} {% block content-area %}
Use the left panel to write guidelines for labelers using Markdown. It will be available for the labelers during annotation. You can include text, links, images and other elements from the markdown language.


| Package | com.sibirjak.angara.sequence |
| Class | public class PagedSequenceEvent |
| Inheritance | PagedSequenceEvent SequenceEvent LoaderItemEvent flash.events.Event |
| Method | Defined by | ||
|---|---|---|---|
|
PagedSequenceEvent(type:String, sequence:ISequence)
Creates a new PagedSequenceEvent.
| PagedSequenceEvent |
| Constant | Defined by | ||
|---|---|---|---|
| ADD : String = "item_added" [static]
A loader has been added.
| SequenceEvent | ||
| CLEAR : String = "item_clear" [static]
Item container has been cleared.
| LoaderItemEvent | ||
| COMPLETE : String = "item_complete" [static]
All containing loaders are finished (either complete or failed).
| SequenceEvent | ||
| FAILURE : String = "item_failure" [static]
Loading resource has been failed.
| LoaderItemEvent | ||
| PAGE_COMPLETE : String = "sequence_page_complete" [static]
Sequence range loaded.
| PagedSequenceEvent | ||
| PAUSE : String = "item_pause" [static]
Sequence paused.
| SequenceEvent | ||
| PROGRESS : String = "item_progress" [static]
Progress of sequence has changed.
| SequenceEvent | ||
| REMOVE : String = "item_removed" [static]
A loader has been removed.
| SequenceEvent | ||
| RESUME : String = "item_resume" [static]
Sequence or any containing loader resumed.
| SequenceEvent | ||
| STOP : String = "item_stop" [static]
Sequence stopped.
| SequenceEvent |
| PagedSequenceEvent | () | constructor |
public function PagedSequenceEvent(type:String, sequence:ISequence)
Creates a new PagedSequenceEvent.
Parameterstype:String — Type of the event.
|
|
sequence:ISequence — Reference to the sequence.
|
| PAGE_COMPLETE | constant |
public static const PAGE_COMPLETE:String = "sequence_page_complete"
Sequence range loaded.


Rule Bases
Rule bases are collections of rules. Rule bases are created by writing a knowledge rule base (.krb) file with your favorite text editor.
A single rule base may contain both forward-chaining and backward-chaining rules.
The forward-chaining rules are run automatically when the rule base is activated to assert new statements of fact. Thus, forward-chaining rules are not directly used to determine whether any particular statement is true.
But backward-chaining rules are directly used to determine whether a particular statement is true. Thus, when a rule base name (or, more properly, a rule base category name, explained below) is used as the knowledge base name in a statement, it refers to the backward-chaining rules within that rule base.
Note
Pyke runs all forward-chaining rules before running any backward-chaining rules.
Thus, using rule base names as the knowledge base name in statements within a forward-chaining rule is prohibited, as this would cause backward-chaining rules to run in order to process the forward-chaining rule.
Why Multiple Rule Bases?
There are two reasons to have more than one rule base (i.e., more than one .krb file):
To divide a large set of rules into human manageable units.
In this case, you want Pyke to use all of the rule bases combined.
For example, you may have rules governing the automatic generation of SQL statements, and other rules governing the generation of HTML documents. You want to keep these rules in different rule bases to make them more manageable.
To enable your Python program to choose between different rule bases that are tailored to different specific situations.
For example, some of the rules governing the automatic generation of SQL statements may vary depending upon the target database (e.g., mysql, postgresql, oracle).
In this case, you want to be able to tell Pyke which of several rule bases to use on each invocation, depending upon which target database you will be accessing. You would never use more than one of these rule bases at the same time, so these rule bases are mutually exclusive.
These two goals are met by three capabilities:
Rule Base Categories
All rule bases are grouped into categories. Each rule base category only gets to have one active rule base.
Thus, you place rule bases that you want to have active simultaneously into different rule base categories; and place rule bases that are mutually exclusive with each other (e.g., the mysql, postgresql and oracle rule bases) into the same rule base category.
Each rule base category has a unique name. In the example above you would want two rule base categories: database and html_generation.
The rule base category name is used as the knowledge base name for statements within rules of one rule base category that want to refer to rules within another rule base category. For example, rule bases in the html_generation category would need to use database.insert(...) to refer to the insert rules in the database category.
Rule Base Inheritance
The rule bases within the same category share rules amongst themselves through rule base inheritance.
Rule bases use single inheritance to inherit the rules from one other rule base. This can go on to any depth. Both forward-chaining and backward-chaining rules are inherited.
This allows mutually exclusive rule bases to share common rules in a parent rule base without having to duplicate these rules amongst themselves.
Here is the definition, then, of a rule base category:
Each root rule base (through rule base inheritance) defines a unique rule base category. All rule bases derived (directly or indirectly) from that root rule base are in the same rule base category.
The name of the rule base category is simply the name of its root rule base.
So, our database and html_generation example would look like this:
We have one root rule base called database and it has derived rule bases called mysql, postgresql and oracle. And a second root rule base called html_generation with firefox and internet_explorer.
The two root rule bases define two rule base categories:
- database, which includes:
- database
- mysql
- postgresql
- oracle
- html_generation, which includes:
- html_generation
- firefox
- internet_explorer
Note
The .krb files for these rule bases may be placed anywhere you want them within your Pyke source directory structure -- in other words, your directory structure is not required to match your rule base inheritance structure.
Only one rule base from each rule base category may be active at any point in time.
Within each of these rule bases, if the knowledge base name is omitted from a statement within a backward-chaining rule, it defaults to the rule base category of that rule base, not the rule base itself. Thus, insert(...) within postgresql would mean database.insert(...), and make_tag(...) within firefox would mean html_generation.make_tag(...).
Important
Note that referring to a rule base category (either explicitly or implicitly) always refers to the active rule base within that category. This may not be the rule base with that name (the root rule base), or even the rule base making implicit use of the rule base category. For example, insert(...) within postgresql will end up referring to insert rules within the oracle rule base when oracle is the active rule base.
All rules referring to foreign rule base categories must explicitly use the rule base category name. For example, to refer to the insert rule for databases, within the html_generation category, you would have to say database.insert(...).
In this way, all of the rules will work no matter which rule base is active within each rule base category.
Rule Inheritance
There is an important difference between how backward-chaining rule inheritance works within Pyke rule bases and how method inheritance works within Python classes:
When a derived class in Python defines a method by the same name as a method in its parent class, the derived method overrides the parent method. I.e., only the derived method is used when a call is made to it.
In contrast, when a derived rule base in Pyke defines backward-chaining rules for a goal that also has backward-chaining rules defined for it in the parent rule base, the derived rule extends the set of rules that may be used to try to prove this goal. All of the derived rules will be tried first. If all of these fail, then the parent rules are tried.
If you don't want the parent rules to be used for a particular goal, you must list that goal name in the without clause of the extending statement at the beginning of the derived rule base.
Note
All forward-chaining rules in the parent rule base are always included in the derived rule base. The without clause only applies to backward-chaining rules.
Rule Base Activation
Loading rule bases only makes them available for use. It does not automatically activate any of them. This must be done explicitly by your Python program. Your program may decide to activate different rule bases in different situations.
Additionally, forward-chaining rules may be used to activate more specific rule bases, based upon their inferencing. But once a rule base has been activated for a rule base category, only children of the currently active rule base may be activated from that point on. Because these children inherit the rules of the currently active rule base; activating child rule bases only adds new rules, and doesn't take any away. Thus, any forward-chaining rule run during the activation of the first rule base are not invalidated by activating the second rule base.
In our database example, your program could activate the root database rule base and let the forward-chaining rules within the database rule base figure out which derived rule base to activate depending on the particular database in use at the time the program is run.


Earlier today, FIRSTNAME LASTNAME, a recently employed Associate Consultant, was conclusively proven to be an undercover operative working for IAM, the notorious subversive hacker collective.
"FIRSTNAME did an impressive job playing the part of the loyal employee," says Sandra Silvern, head of the personal information team at the UK branch. "However, PRONOUN exposed himself when asked to make recommendations concerning certain subversive citizens."
"In spite of overwhelming evidence of subversion, FIRSTNAME tried to cover this up and refused to assign high threat levels to any of the subversives. Luckily, I had assigned more experienced consultants to review POSSESSIVE results. It didn't take them long to realize what PRONOUN was doing. If I hadn't been so diligent, FIRSTNAME might have done a great deal of harm to the investigation."
"Investigation revealed that TITLE LASTNAME had recently been in contact with other IAM operatives," adds Oskar Jönsson, head of IT security for the UK branch. "Immediate steps were taken to isolate OBJECTPRONOUN and transfer the case to other employees. Most of the data was still intact, so we should be able to make our case without too much trouble. All told, this could have been a lot worse."
"This is a tragic event", says CEO Alex DuMaurier, speaking to a group of approved media representatives. "But it also confirms the importance of the work we are doing here at AlethiCorp. Were it not for our information management efforts, subversives such as TITLE LASTNAME would be free to pursue their activities, to the detriment of decent citizens."
"However, we must remember that FIRSTNAME LASTNAME, and others like OBJECTPRONOUN, are misguided souls, who should be pitied, not hated. We are working with the Larkhill Resettlement Council to resettle TITLE LASTNAME to an appropriate location, where PRONOUN can be safely rehabilitated. Let us hope that PRONOUN one day finds POSSESSIVE place as a productive citizen of the Union."
Added Mx. DuMaurier: "In retrospect, we should have seen it coming. Those 'BEARTYPE' types are never reliable. I will ensure that steps are taken to improve our hiring processes."


An HTTP client that maintains a pool of connections to a specific host, at a specific port.
Represents a client-side HTTP request.
Represents a client-side HTTP response.
An HTTP and WebSockets server
Represents a server-side HTTP request.
Represents a server-side HTTP response.
Not sure whether this kind of RouteMatcher should stay in Scala.
Represents a server side WebSocket that is passed into a the websocketHandler of an org.vertx.scala.core.http.HttpServer
Represents a client side WebSocket.
Represents an HTML 5 Websocket
Factory for org.vertx.scala.core.http.HttpClient instances by wrapping a Java instance.
Factory for org.vertx.scala.core.http.HttpClientRequest instances, by wrapping a Java instance.
Factory for org.vertx.scala.core.http.HttpClient instances by wrapping a Java instance.
Factory for org.vertx.scala.core.http.HttpServer instances by wrapping a Java instance.
Factory for org.vertx.scala.core.http.HttpServerResponse instances.
Factory for org.vertx.scala.core.http.RouteMatcher instances.
Factory for org.vertx.scala.core.http.ServerWebSocket instances.
Factory for org.vertx.scala.core.http.WebSocket instances.
Implicit conversion for org.vertx.java.core.MultiMap to scala.collection.mutable.MultiMap.
Implicit conversion for scala.collection.mutable.MultiMap to org.vertx.java.core.MultiMap.


Press n or j to go to the next uncovered block, b, p or k for the previous block.
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| docs/site/components |
|
71.43% | 5/7 | 100% | 0/0 | 33.33% | 2/6 | 71.43% | 5/7 |
| docs/site/components/step |
|
9.09% | 5/55 | 0% | 0/22 | 31.25% | 5/16 | 9.09% | 5/55 |
| src |
|
96.88% | 62/64 | 62.5% | 5/8 | 100% | 2/2 | 96.88% | 62/64 |
| src/brand |
|
50% | 2/4 | 0% | 0/2 | 100% | 1/1 | 50% | 2/4 |
| src/components/action-sheet |
|
98% | 49/50 | 85.71% | 30/35 | 100% | 9/9 | 97.22% | 35/36 |
| src/components/action-sheet/demo |
|
47.06% | 8/17 | 100% | 0/0 | 63.64% | 7/11 | 47.06% | 8/17 |
| src/components/badge |
|
100% | 14/14 | 100% | 9/9 | 100% | 2/2 | 100% | 11/11 |
| src/components/badge/demo |
|
66.67% | 2/3 | 100% | 0/0 | 50% | 1/2 | 66.67% | 2/3 |
| src/components/button |
|
93.1% | 27/29 | 83.33% | 10/12 | 75% | 3/4 | 90% | 18/20 |
| src/components/button/demo |
|
60% | 3/5 | 100% | 0/0 | 33.33% | 1/3 | 60% | 3/5 |
| src/components/calendar |
|
73.75% | 177/240 | 67.48% | 83/123 | 71.43% | 25/35 | 71.36% | 142/199 |
| src/components/calendar/demo |
|
16.67% | 3/18 | 100% | 0/0 | 12.5% | 1/8 | 16.67% | 3/18 |
| src/components/cascader |
|
86.46% | 83/96 | 71.43% | 40/56 | 92.31% | 24/26 | 88.76% | 79/89 |
| src/components/cascader/demo |
|
32.26% | 10/31 | 0% | 0/15 | 15.38% | 2/13 | 32.26% | 10/31 |
| src/components/cell |
|
96.88% | 31/32 | 96.88% | 31/32 | 75% | 3/4 | 95.83% | 23/24 |
| src/components/cell-group |
|
90.91% | 10/11 | 75% | 3/4 | 100% | 1/1 | 90% | 9/10 |
| src/components/cell/demo |
|
75% | 3/4 | 100% | 0/0 | 66.67% | 2/3 | 75% | 3/4 |
| src/components/checkbox |
|
77.14% | 54/70 | 65% | 39/60 | 100% | 7/7 | 76.47% | 52/68 |
| src/components/checkbox-group |
|
92.86% | 13/14 | 100% | 0/0 | 80% | 4/5 | 92.31% | 12/13 |
| src/components/checkbox/demo |
|
50% | 3/6 | 100% | 0/0 | 25% | 1/4 | 50% | 3/6 |
| src/components/checker |
|
86.21% | 25/29 | 70% | 7/10 | 100% | 7/7 | 85.19% | 23/27 |
| src/components/checker-item |
|
84% | 42/50 | 74.36% | 29/39 | 100% | 5/5 | 88.37% | 38/43 |
| src/components/checker/demo |
|
30% | 3/10 | 100% | 0/0 | 14.29% | 1/7 | 30% | 3/10 |
| src/components/col |
|
100% | 10/10 | 100% | 6/6 | 100% | 2/2 | 100% | 8/8 |
| src/components/col/demo |
|
100% | 2/2 | 100% | 0/0 | 100% | 1/1 | 100% | 2/2 |
| src/components/collapse |
|
100% | 13/13 | 100% | 4/4 | 100% | 3/3 | 100% | 12/12 |
| src/components/collapse-item |
|
89.06% | 57/64 | 74.36% | 29/39 | 90% | 9/10 | 87.72% | 50/57 |
| src/components/collapse/demo |
|
100% | 2/2 | 100% | 0/0 | 100% | 1/1 | 100% | 2/2 |
| src/components/datetime-picker |
|
87.83% | 101/115 | 78.95% | 30/38 | 100% | 6/6 | 87.74% | 93/106 |
| src/components/datetime-picker/demo |
|
100% | 4/4 | 100% | 0/0 | 100% | 3/3 | 100% | 4/4 |
| src/components/dialog |
|
92.86% | 39/42 | 92.31% | 36/39 | 75% | 6/8 | 92.68% | 38/41 |
| src/components/dropdown |
|
92.11% | 35/38 | 92.86% | 13/14 | 87.5% | 7/8 | 93.75% | 30/32 |
| src/components/dropdown-item |
|
93.33% | 56/60 | 95.45% | 21/22 | 81.82% | 9/11 | 91.49% | 43/47 |
| src/components/dropdown/demo |
|
66.67% | 4/6 | 100% | 0/0 | 66.67% | 4/6 | 66.67% | 4/6 |
| src/components/field |
|
67.24% | 78/116 | 64.79% | 46/71 | 90.91% | 10/11 | 58.43% | 52/89 |
| src/components/field/demo |
|
75% | 3/4 | 100% | 0/0 | 50% | 1/2 | 75% | 3/4 |
| src/components/header |
|
100% | 32/32 | 95.24% | 20/21 | 100% | 3/3 | 100% | 26/26 |
| src/components/header-tab |
|
77.78% | 14/18 | 75% | 3/4 | 75% | 3/4 | 75% | 12/16 |
| src/components/header-tabs |
|
65% | 13/20 | 100% | 0/0 | 20% | 1/5 | 61.11% | 11/18 |
| src/components/header/demo |
|
50% | 2/4 | 100% | 0/0 | 33.33% | 1/3 | 50% | 2/4 |
| src/components/icon |
|
91.67% | 11/12 | 75% | 6/8 | 100% | 1/1 | 90.91% | 10/11 |
| src/components/image-preview |
|
62.95% | 192/305 | 55.56% | 80/144 | 47.22% | 17/36 | 58.63% | 146/249 |
| src/components/image-preview/demo |
|
38.89% | 7/18 | 100% | 0/0 | 12.5% | 1/8 | 38.89% | 7/18 |
| src/components/loading |
|
94.74% | 18/19 | 100% | 6/6 | 50% | 1/2 | 93.33% | 14/15 |
| src/components/loading/demo |
|
66.67% | 2/3 | 100% | 0/0 | 50% | 1/2 | 66.67% | 2/3 |
| src/components/message-box |
|
60% | 48/80 | 42.86% | 21/49 | 76.92% | 10/13 | 61.54% | 48/78 |
| src/components/message-box/demo |
|
8.82% | 3/34 | 50% | 1/2 | 6.9% | 2/29 | 8.82% | 3/34 |
| src/components/notice-bar |
|
97.14% | 34/35 | 91.67% | 11/12 | 100% | 7/7 | 96.43% | 27/28 |
| src/components/notice-bar/demo |
|
75% | 3/4 | 100% | 0/0 | 50% | 1/2 | 75% | 3/4 |
| src/components/on-loading |
|
66.67% | 6/9 | 0% | 0/2 | 50% | 1/2 | 75% | 6/8 |
| src/components/overlay |
|
92.31% | 12/13 | 100% | 2/2 | 50% | 1/2 | 91.67% | 11/12 |
| src/components/picker |
|
67.86% | 76/112 | 58.75% | 47/80 | 77.78% | 7/9 | 65.63% | 63/96 |
| src/components/picker-column |
|
82.24% | 88/107 | 63.33% | 19/30 | 66.67% | 8/12 | 81.9% | 86/105 |
| src/components/picker/demo |
|
18.18% | 2/11 | 100% | 0/0 | 16.67% | 1/6 | 18.18% | 2/11 |
| src/components/popup |
|
100% | 25/25 | 100% | 6/6 | 100% | 4/4 | 100% | 21/21 |
| src/components/popup/demo |
|
100% | 2/2 | 100% | 0/0 | 100% | 1/1 | 100% | 2/2 |
| src/components/progress |
|
100% | 23/23 | 91.67% | 11/12 | 100% | 1/1 | 100% | 17/17 |
| src/components/progress/demo |
|
42.86% | 3/7 | 16.67% | 1/6 | 50% | 2/4 | 42.86% | 3/7 |
| src/components/pull-refresh |
|
84.07% | 95/113 | 80.81% | 80/99 | 91.67% | 11/12 | 83.5% | 86/103 |
| src/components/pull-refresh/demo |
|
14.29% | 2/14 | 100% | 0/0 | 14.29% | 1/7 | 14.29% | 2/14 |
| src/components/radio |
|
67.21% | 41/61 | 57.14% | 28/49 | 80% | 4/5 | 66.67% | 40/60 |
| src/components/radio-group |
|
100% | 11/11 | 100% | 0/0 | 100% | 4/4 | 100% | 10/10 |
| src/components/radio/demo |
|
30% | 3/10 | 100% | 0/0 | 14.29% | 1/7 | 30% | 3/10 |
| src/components/row |
|
100% | 12/12 | 100% | 8/8 | 100% | 2/2 | 100% | 10/10 |
| src/components/search |
|
100% | 22/22 | 90% | 9/10 | 100% | 4/4 | 100% | 21/21 |
| src/components/search/demo |
|
66.67% | 2/3 | 100% | 0/0 | 50% | 1/2 | 66.67% | 2/3 |
| src/components/slider |
|
78.33% | 47/60 | 58.82% | 20/34 | 100% | 4/4 | 79.31% | 46/58 |
| src/components/slider/demo |
|
66.67% | 2/3 | 100% | 0/0 | 50% | 1/2 | 66.67% | 2/3 |
| src/components/step |
|
97.67% | 42/43 | 80% | 24/30 | 100% | 6/6 | 96.97% | 32/33 |
| src/components/stepper |
|
95.45% | 42/44 | 83.33% | 10/12 | 100% | 8/8 | 100% | 41/41 |
| src/components/stepper/demo |
|
75% | 3/4 | 100% | 0/0 | 50% | 1/2 | 75% | 3/4 |
| src/components/steps |
|
100% | 10/10 | 100% | 0/0 | 100% | 1/1 | 100% | 8/8 |
| src/components/steps/demo |
|
50% | 2/4 | 100% | 0/0 | 50% | 1/2 | 50% | 2/4 |
| src/components/swipe |
|
87.88% | 116/132 | 78.21% | 61/78 | 77.78% | 7/9 | 85.96% | 98/114 |
| src/components/swipe-cell |
|
94.29% | 66/70 | 92.31% | 48/52 | 83.33% | 5/6 | 96.92% | 63/65 |
| src/components/swipe-cell/demo |
|
13.33% | 2/15 | 0% | 0/6 | 14.29% | 1/7 | 13.33% | 2/15 |
| src/components/swipe-item |
|
100% | 10/10 | 100% | 0/0 | 100% | 1/1 | 100% | 9/9 |
| src/components/swipe/demo |
|
66.67% | 2/3 | 100% | 0/0 | 50% | 1/2 | 66.67% | 2/3 |
| src/components/switch |
|
100% | 16/16 | 50% | 4/8 | 100% | 2/2 | 100% | 13/13 |
| src/components/tab |
|
92% | 23/25 | 94.74% | 18/19 | 100% | 3/3 | 91.3% | 21/23 |
| src/components/tab/demo |
|
23.08% | 3/13 | 100% | 0/0 | 11.11% | 1/9 | 23.08% | 3/13 |
| src/components/table |
|
8.49% | 49/577 | 0% | 0/382 | 0% | 0/53 | 7.5% | 36/480 |
| src/components/tabs |
|
83.17% | 168/202 | 68.92% | 102/148 | 100% | 23/23 | 83.71% | 149/178 |
| src/components/tag |
|
100% | 26/26 | 92.86% | 13/14 | 100% | 1/1 | 100% | 17/17 |
| src/components/tag/demo |
|
60% | 3/5 | 100% | 0/0 | 33.33% | 1/3 | 60% | 3/5 |
| src/components/toast |
|
87.88% | 87/99 | 74% | 37/50 | 86.36% | 19/22 | 88.89% | 80/90 |
| src/components/toast/demo |
|
10% | 1/10 | 100% | 0/0 | 0% | 0/9 | 10% | 1/10 |
| src/components/tree |
|
72.09% | 124/172 | 63.89% | 69/108 | 64.52% | 20/31 | 72.48% | 108/149 |
| src/components/tree/demo |
|
33.33% | 2/6 | 0% | 0/2 | 33.33% | 1/3 | 33.33% | 2/6 |
| src/components/upload |
|
12.75% | 13/102 | 9.09% | 6/66 | 10.53% | 2/19 | 11.88% | 12/101 |
| src/components/upload/demo |
|
6.38% | 3/47 | 0% | 0/16 | 8.33% | 1/12 | 6.38% | 3/47 |
| src/locale |
|
64% | 16/25 | 41.67% | 5/12 | 100% | 1/1 | 68.18% | 15/22 |
| src/locale/lang |
|
100% | 2/2 | 100% | 0/0 | 100% | 0/0 | 100% | 2/2 |
| src/mixins |
|
92.68% | 114/123 | 72.41% | 42/58 | 91.3% | 21/23 | 92.17% | 106/115 |
| src/mixins/popup |
|
93.81% | 106/113 | 83.33% | 55/66 | 92.86% | 13/14 | 94.29% | 99/105 |
| src/utils |
|
87.27% | 48/55 | 79.31% | 23/29 | 84.62% | 11/13 | 87.04% | 47/54 |
| src/utils/create |
|
83.75% | 67/80 | 69.39% | 34/49 | 86.36% | 19/22 | 85.33% | 64/75 |
| src/utils/dom |
|
71.05% | 54/76 | 57.14% | 32/56 | 61.11% | 11/18 | 70% | 49/70 |
| src/utils/format |
|
65.52% | 38/58 | 62.22% | 28/45 | 91.67% | 11/12 | 71.15% | 37/52 |
| src/utils/json |
|
20% | 2/10 | 0% | 0/7 | 0% | 0/3 | 20% | 2/10 |
| tests |
|
81.54% | 53/65 | 80% | 32/40 | 84% | 21/25 | 83.05% | 49/59 |


{% extends "documentation.html" %} {% block document %}
Hello, and welcome to StashBoard, the open-source status dashboard. StashBoard's REST API allows users to programmatically update and manage web service status.
This document will only cover the basics of the StashBoard. See the REST API section for full documentation.
The StashBoard REST API is broken down into three resources: Services, Events, and Statuses.
Services are the basic unit of StashBoard. A service is any web service that can be consumed, and more importantly, can fail. Using StashBoard, you can easily inform your users of the current service status. To handle system status, StashBoard uses the concept of events.
Read more about creating and modifying services in the Status Resource section of the REST API documentation.
A service has a list of events, listed in reverse chronological order, which represent the state of that service. To track the state of a web service, an administrator creates events for a given service.
For example, if a service is currently down, create an event with a "DOWN" status, explaining why the service isn't working. Once the service is up again, simply create a new event with an attached "UP" status.
Read more about creating and modifying events in the Events Resource section of the REST API documentation.
A status represents the state of a web service. Instead of being directly attached to services, a status is attached to a service event (described above). Therefore, the current system status is simply the status attached to the most recent event.
Read more about creating and modifying statuses in the Status Resource section of the REST API documentation.
To access information through the REST API, no authentication is required. However, to change any information via the REST API (POST/PUT/DELETE), authentication and SSL are required.
StashBoard uses OAuth for authentication purposes. To authenticate your account and obtain your API keys, head over to the API Credentials section.


{% extends 'base.html'%} {% block content %}
Welcome to CodeWars API.A site where you can have access to codewars challenges and share your solutions comments and likes on posted solutions
AlvinNgunjiri • Collaborator | Caiseyann • Collaborator | MachokaDaisy • Collaborator | MusyokiMutua • Collaborator | MichaelOmondi • Collaborator | PeterWaithaka • Collaborator


I joined IBM in 2011 when I just graduated from Peking University. I started
my internship 1.5 year earlier in the same team, that’s when I began to work on
Hadoop. Our team was created to incubate a “startup” project called BigInsights
,
(later known as IOP
), an apache Hadoop based BigData platform. We started from
scratch, in the first few years, I was focusing on creating a cluster provisioning
and monitoring system, written by Java and Shell code. I started to lead the installation
backend team since 3rd quarter of 2011. I took the full ownership of this component,
and lead a 3~4 people team for production development. I worked with some
front-end folks in Canada and some other component owners in U.S closely on end-to-end
integration. At that time, I engaged more than 50 customers and handles lots of
urgent issues during which earned a lot of experiences.
From 2015, I moved on and switched my role to open source Hadoop team lead. I lead up a 3 people team to work on the IBM distribution of Hadoop, co-own this component with U.S peer team. My object was to ensure IBM distro of Hadoop fully satisfies customer’s requirements. I fixed a lot of bugs and made a lot improvements, and I was also very active contributing these to apache community. In 2 years time, I’ve contributed more than 100 patches to HDFS, YARN and Hadoop common.
Since 1 quarter of 2017, I started work on Ozone
project. This project is leading
by some Hadoop PMCs from Hortonworks. It is quite famous because of its ambition of
fixing long-standing HDFS scalability and small-file problems. At Sep 2017, I was
recognized to become to be an Apache Hadoop Committer
.


File generated from /Users/xenykr/Documents/project/Tellet/ssam/apps/ssam_message/.eunit/ssam_message_topic_handler.erl by COVER 2014-10-08 at 11:23:43 **************************************************************************** | %% ------------------------------------------------------------------------ | %% Copyright (c) 2014, Kook Maeng<EMAIL_ADDRESS>| %% | %% Permission to use, copy, modify, and/or distribute this software for any | %% purpose with or without fee is hereby granted, provided that the above | %% copyright notice and this permission notice appear in all copies. | %% | %% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | %% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | %% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | %% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | %% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | %% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | %% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | %% ------------------------------------------------------------------------ | | -module(ssam_message_topic_handler). | | -behaviour(cowboy_loop_handler). | -behaviour(cowboy_websocket_handler). | | %% Callbacks for Loop Handler | -export([init/3, | info/3, | terminate/3]). | | %% Callbacks for REST | -export([rest_init/2, | is_authorized/2, | content_types_provided/2, | content_types_accepted/2, | allowed_methods/2, | malformed_request/2, | handle/2, | options/2, | get_resource/2, | post_resource/2, | put_resource/2, | delete_resource/2 | ]). | | %% Callbacks for Websocket | -export([websocket_init/3, | websocket_handle/3, | websocket_info/3, | websocket_terminate/3 | ]). | | | -include_lib("ssam/include/ssam.hrl"). | -include("ssam_message.hrl"). | | | init(_Transport, Req, []) -> | %lager:debug("~p:init -> Req: ~p", [?MODULE, Req]), 0..| {Method, _} = cowboy_req:method(Req), 0..| {Path, _} = cowboy_req:path(Req), 0..| {Upgrade, _} = cowboy_req:header(<<"upgrade">>, Req), 0..| [<<>>, _Service, _Version | Uri] = binary:split(Path, <<"/">>, [global]), 0..| case Uri of | [<<"topics">>, _, <<"updates">>] when Upgrade =:= <<"websocket">> -> 0..| {upgrade, protocol, cowboy_websocket}; | [<<"topics">>, _, <<"updates">>] when Method =:= <<"GET">> -> 0..| {ok, Req1, State} = ssam_rest:parse_request(Req), 0..| handle_get(Req1, State); | _ -> 0..| {upgrade, protocol, cowboy_rest} | end. | | | %% Loop handlers | | handle(Req, State) -> 0..| {ok, Req, State}. | | info({push, TopicKey, Msgs, Ref, From}, Req, State) -> 0..| lager:debug("updated, TopicKey: ~p, From: ~p", [TopicKey, From]), 0..| case ssam_objects:value(topic_key, State#request.props) of | TopicKey -> 0..| From ! {ok, Ref}, | %Msgs = binary_to_term(MsgsBin), 0..| Body = [{[{<<"_id">>, X#topic_message.msg_id}] ++ X#topic_message.msg_body} 0..| || X <- Msgs], 0..| Response = ssam_rest:response(Body, State), 0..| info({reply, Response}, Req, State); | _ -> | %From ! {{?error, ?invalid_client}, Ref, self()}, 0..| {loop, Req, State, hibernate} | end; | info({reply, Response}, Req, State) -> 0..| case State#request.transport of | eventsource -> 0..| ok = ssam_rest:chunk(Response, Req), | %{loop, Req, State, ?LOOP_TIMEOUT}; 0..| {loop, Req, State}; | _ -> 0..| {ok, _Req1, _State1} = ssam_rest:reply(Response, Req, State) | end; | info({stop, TopicKey}, Req, State) -> 0..| lager:debug("stop, TopicKey: ~p", [TopicKey]), 0..| case proplists:get_value(topic_key, State#request.props) of 0..| TopicKey -> {ok, Req, State}; 0..| _ -> {loop, Req, State, hibernate} | end; | info(Unknown, Req, State) -> 0..| lager:warning("Unknown: ~p", [?MODULE, Unknown]), 0..| {loop, Req, State, hibernate}. | | terminate(Reason, _Req, #request{props = Props, from = ClientPid}) -> 0..| lager:debug("Reason: ~p", [Reason]), 0..| case proplists:get_value(topic_key, Props) of 0..| ?undefined -> lager:warning("topic_key undefined"); 0..| TopicKey -> ssam_message_topic_server:delete_client(TopicKey, ClientPid) | end. | | handle_get(is_authorized, {Req, State}) -> 0..| case is_authorized(Req, State) of | {true, Req1, State1} -> 0..| handle_get(check_malformed_request, {Req1, State1}); | _ -> 0..| handle_get(?error, {?STATUS_UNAUTHORIZED, [], Req, State}) | end; | handle_get(check_malformed_request, {Req, State}) -> 0..| case malformed_request(Req, State) of | {false, _, _} -> 0..| handle_get(check_transport, {Req, State}); | {true, _, _} -> 0..| handle_get(?error, {?STATUS_BAD_REQUEST, [], Req, State}) | end; | handle_get(check_transport, {Req, State}) -> 0..| case cowboy_req:header(<<"accept">>, Req) of | {<<"text/event-stream">>, Req1} -> 0..| State1 = State#request{transport = eventsource}, 0..| {ok, Req2, State2} = ssam_rest:chunked_reply(Req1, State1), 0..| handle_get(route, {Req2, State2}); | _ -> 0..| handle_get(route, {Req, State}) | end; | handle_get(route, {Req, State}) -> 0..| case ssam_vnode:local_route(ssam_message_topic_resource, get, State#request{}) of | {ok, State1} -> 0..| case | case proplists:get_value(<<"timeout">>, State#request.params) of 0..| ?undefined -> ?TOPIC_HTTPLOOP_TIMEOUT; 0..| Val -> binary_to_integer(Val) * 1000 | end | of | Timeout when Timeout < (30*1000) -> 0..| {loop, Req, State1, Timeout}; | Timeout -> 0..| {loop, Req, State1, Timeout, hibernate} | end; | {?error, Response} -> 0..| lager:error("Response: ~p", [Response]), 0..| {ok, _Req1, _State1} = ssam_rest:reply(Response, Req, State) | end; | handle_get(?error, {Code, Msg, Req, State}) -> 0..| Response = ssam_rest:response(Code, Msg, State), 0..| {ok, _Req1, _State1} = ssam_rest:reply(Response, Req, State); | handle_get(Req, State) -> 0..| handle_get(is_authorized, {Req, State}). | | | %% REST handlers | | rest_init(Req, _Options) -> 0..| {ok, _Req, _State} = ssam_rest:parse_request(Req). | | is_authorized(Req, State) -> 0..| ssam_auth:is_authorized(Req, State). | | allowed_methods(Req, State) -> 0..| {[<<"GET">>, <<"POST">>, <<"PUT">>, <<"DELETE">>, <<"OPTIONS">>], Req, State}. | | content_types_provided(Req, State) -> 0..| {[ | {{<<"application">>, <<"json">>, []}, get_resource} | ], Req, State}. | | content_types_accepted(Req, #request{method = Method} = State) -> 0..| Handler = case Method of 0..| <<"PUT">> -> put_resource; 0..| <<"POST">> -> post_resource; 0..| Else -> throw({error, {unkown_method, Else}}) | end, 0..| {[ | {{<<"application">>, <<"x-www-form-urlencoded">>, []}, Handler} | ], Req, State}. | | malformed_request(Req, State) -> 0..| {malformed_request(State), Req, State}. | | malformed_request(#request{method = <<"POST">>, uri = Uri, body = Params}) -> 0..| case Uri of | [<<"topics">>] -> 0..| not ssam_objects:is_all_defined([<<"id">>], Params); 0..| [<<"topics">>, _, <<"updates">>] -> false; | [<<"topics">>, _, <<"subscribers">>] -> 0..| not ( | ssam_objects:is_all_defined([<<"id">>, <<"type">>], Params) and | is_valid_params(Params) | ); 0..| _ -> true | end; | malformed_request(#request{method = <<"PUT">>, uri = Uri, body = Params}) -> 0..| case Uri of 0..| [<<"topics">>, _] -> false; | [<<"topics">>, _, <<"subscribers">>, _] -> 0..| not ssam_objects:is_all_defined([<<"callback_url">>], Params); 0..| _ -> true | end; | malformed_request(_) -> 0..| false. | | options(Req, State) -> 0..| Req1 = cowboy_req:set_resp_header(<<"access-control-allow-methods">>, | <<"GET, POST, OPTIONS">>, Req), 0..| Req2 = cowboy_req:set_resp_header(<<"access-control-allow-origin">>, | State#request.origin, Req1), | %Req3 = cowboy_req:set_resp_header(<<"access-control-allow-credentials">>, <<"true">>, Req2), 0..| {ok, Req2, State}. | | get_resource(Req, State) -> 0..| {_, Response} = ssam_vnode:route(ssam_message_topic_resource, | get, State#request{}), 0..| lager:debug("Response: ~p", [Response]), 0..| {ok, Req1, State1} = ssam_rest:reply(Response, Req, State), 0..| {halt, Req1, State1}. | | post_resource(Req, State) -> 0..| {_, Response} = ssam_vnode:route(ssam_message_topic_resource, | post, State#request{}), | 0..| lager:debug("Response: ~p", [Response]), 0..| {ok, Req1, State1} = ssam_rest:reply(Response, Req, State), 0..| {halt, Req1, State1}. | | put_resource(Req, State) -> 0..| {_, Response} = ssam_vnode:route(ssam_message_topic_resource, | put, State#request{}), 0..| lager:debug("Response: ~p", [Response]), 0..| {ok, Req1, State1} = ssam_rest:reply(Response, Req, State), 0..| {halt, Req1, State1}. | | delete_resource(Req, State) -> 0..| {_, Response} = ssam_vnode:route(ssam_message_topic_resource, | delete, State#request{}), 0..| lager:debug("Response: ~p", [Response]), 0..| {ok, Req1, State1} = ssam_rest:reply(Response, Req, State), 0..| {halt, Req1, State1}. | | | %% Websocket handlers | | websocket_init(_TransportName, Req, _Opts) -> 0..| {ok, Req1, State} = ssam_rest:parse_request(Req), | %erlang:start_timer(10*1000, self(), <<"Hello!">>), 0..| case handle_get(Req1, State) of | {ok, State1} -> 0..| Timeout = | case proplists:get_value(<<"timeout">>, State#request.params) of 0..| ?undefined -> ?TOPIC_WEBSOCKET_TIMEOUT; 0..| Val -> binary_to_integer(Val) * 1000 | end, 0..| {ok, Req1, State1, Timeout}; | {?error, Response} -> 0..| lager:error("Response: ~p", [Response]), 0..| {ok, _Req1, _State1} = ssam_rest:reply(Response, Req, State) | end. | | websocket_handle({text, Msg}, Req, State) -> 0..| {reply, {text, << "That's what she said! ", Msg/binary >>}, Req, State}; | websocket_handle(_Data, Req, State) -> 0..| {ok, Req, State}. | | websocket_info({timeout, _Ref, _Msg}, Req, State) -> | %erlang:start_timer(10*1000, self(), <<"How' you doin'?">>), | %{reply, {text, Msg}, Req, State}; 0..| {ok, Req, State, hibernate}; | websocket_info(_Info, Req, State) -> 0..| {ok, Req, State}. | | websocket_terminate(_Reason, _Req, _State) -> 0..| ok. | | | %% Private functions | | is_valid_params(Params) -> 0..| case proplists:get_value(<<"type">>, Params, []) of | <<"webhook">> -> 0..| ssam_objects:is_all_defined([<<"callback_url">>], Params); | _ -> 0..| false | end. |


Instructions:
For each increment, you will need to process each sublist in turn. For each sublist, click on its entries in the Input array to highlight them. Once you have the sublist selected, click "Done Selecting". Next, sort the selected items by clicking on them to swap pairs of items. Then click "Done Sorting Sublist" to go on to the next sublist. When you have processed all of the sublists for a given increment, click "Done Increment". Click on "Help" for more details.
Increments to use:
Input:


the Buttle Building
[0, 80]
|
Stephens Cinema
[1, 80]
|
Clipper Drive
[2, 80]
|
the Powlet Building
[3, 80]
|
wasteland
[4, 80]
|
a cemetery
[5, 80]
|
Capes Street
[6, 80]
|
Club Clement
[7, 80]
|
Chalker Park
[8, 80]
|
Vincent Square Police Dept
[9, 80]
|
the Deny Hotel
[0, 81]
|
Mockridge Cinema
[1, 81]
|
a carpark
[2, 81]
|
Ryse Place
[3, 81]
|
Raines Grove
[4, 81]
|
the Potter Monument
[5, 81]
|
Wimbridge Crescent
[6, 81]
|
the Dadson Building
[7, 81]
|
the Fone Arms
[8, 81]
|
a carpark
[9, 81]
|
the Dement Arms
[0, 82]
|
Ryan Grove
[1, 82]
|
Finlay Boulevard
[2, 82]
|
a warehouse
[3, 82]
|
Fyfhyde Plaza
[4, 82]
|
St Aelred's Church
[5, 82]
|
a factory
[6, 82]
|
the Dwyer Monument
[7, 82]
|
a junkyard
[8, 82]
|
Darnell Library
[9, 82]
|
wasteland
[0, 83]
|
Fuller Drive School
[1, 83]
|
Syms Auto Repair
[2, 83]
|
Cyril General Hospital
[3, 83]
|
a factory
[4, 83]
|
Paget Auto Repair
[5, 83]
|
Reakes Grove
[6, 83]
|
the Ffych Building
[7, 83]
|
Naisbitt Library
[8, 83]
|
the Barnefield Monument
[9, 83]
|
a warehouse
[0, 84]
|
Alsoop Park
[1, 84]
|
Crew Avenue Police Dept
[2, 84]
|
the Boon Museum
[3, 84]
|
a factory
[4, 84]
|
the Freeguard Building
[5, 84]
|
Davy Drive
[6, 84]
|
Biffen Lane
[7, 84]
|
Holdoway Drive
[8, 84]
|
the Hinckesman Building
[9, 84]
|
Whittard Road Fire Station
[0, 85]
|
wasteland
[1, 85]
|
Vigar Walk
[2, 85]
|
Lorgh Walk
[3, 85]
|
Punnett Cinema
[4, 85]
|
a junkyard
[5, 85]
|
Scudamore Road
[6, 85]
|
Gully Grove
[7, 85]
|
a warehouse
[8, 85]
|
the Burdett Building
[9, 85]
|
the Brindle Hotel
[0, 86]
|
McTier Grove
[1, 86]
|
Threadgould Road
[2, 86]
|
the Dudoc Hotel
[3, 86]
|
the Feaver Monument
[4, 86]
|
Elsworth Square School
[5, 86]
|
a carpark
[6, 86]
|
the Laurence Building
[7, 86]
|
wasteland
[8, 86]
|
Woollacott Park
[9, 86]
|
Warren Auto Repair
[0, 87]
|
Ketnor Walk
[1, 87]
|
Faraker Bank
[2, 87]
|
the Gullis Museum
[3, 87]
|
Connery Drive
[4, 87]
|
Rendall Plaza
[5, 87]
|
Richings Crescent
[6, 87]
|
Ayers Cinema
[7, 87]
|
a carpark
[8, 87]
|
a carpark
[9, 87]
|
a carpark
[0, 88]
|
Etheldreda General Hospital
[1, 88]
|
Rollason Row
[2, 88]
|
the Kirwan Museum
[3, 88]
|
the Grundy Motel
[4, 88]
|
Perrye Towers
[5, 88]
|
Frye Alley Police Dept
[6, 88]
|
Swonnell Place
[7, 88]
|
the Henley Building
[8, 88]
|
Loader Walk Railway Station
[9, 88]
|
Marton Cinema
[0, 89]
|
a warehouse
[1, 89]
|
the Stancomb Arms
[2, 89]
|
Sansbury Plaza School
[3, 89]
|
a factory
[4, 89]
|
the Carr Monument
[5, 89]
|
Daunt Park
[6, 89]
|
Quekett Road
[7, 89]
|
Woolford Boulevard School
[8, 89]
|
a junkyard
[9, 89]
|
|
Menu
City Map
Find Location
Route Finder
World View
Map Mirror
|


Got7's Jackson Wang trades Food, Language and Sport with James Corden
by Sach007In This Is How We Do It, James Corden and Jackson Wang, hailing from opposite ends of the world, meet for the first time in Los Angeles to teach each other useful phrases in each other's languages, try new foods and compete in a little sport, capped with a penalty kick shootout.


Before diving into using any framework or tool, one has to ask the important question:
RequireJS has two distinct primary functions:
A secondary function can be argued as one of compartmentalisation, such that javascript modules cannot interfere with each other. The importance of each of these functions varies between scenarios and it would be difficult to argue which way is "The Best™"
For example, one could use the rather low-tech option of correctly ordering script tags to ensure that dependencies are correctly resolved and to handle clashes. But this strategy starts to become more and more painful the larger your system gets
You can also use "Poor Man's Namespaces" to keep your code from clashing, for example:
window.SomeNamespace = window.SomeNamespace || {}; (function(ns) { ns.someFunction = function() { }; })(window.SomeNamespace);
Which also works, but takes a bit of maintenance. None of these methods provide a bulletproof way to handle dependencies though, which is why a lot of legacy scripts are loaded after JQuery, for instance, and actual logic is only invoked inside a block like:
$(document).ready(function() { // do your magic here });
And this is open to strange timing conditions as and when the order of execution of these blocks is changed, eg when changing where a script block is inserted in the containing document. And of course, this method relies on the understanding that Javascript files are (traditionally, at least), loaded top-down, synchronously so you should be guaranteed that in the following scenario:
<html> <head> <script type="text/javascript" src="js/dependency.js"></script> <script type="text/javascript" src="js/main.js"></script> </head> <body> </body> </html>
dependency.js
is fully loaded before main.js
is introduced to the DOM, meaning
that if main.js
depends on some exported function in dependency.js
, it will run.
The problem with that is, of course, that users are impatient. They don't want to wait for synchronous
downloading of large amounts of data. Newer browsers respect the async
attribute on
a script tag to make script loading more performant, but then we're back in the boat of trying to resolve
dependency resolution
Other methods for resolving dependencies include the AngularJS way, which works perfectly well as long as you have taken care of script loading already (either through manual script tags, AMD or some kind of bundling / minification process).


SUBROUTINE DLAED7( ICOMPQ, N, QSIZ, TLVLS, CURLVL, CURPBM, D, Q, $ LDQ, INDXQ, RHO, CUTPNT, QSTORE, QPTR, PRMPTR, $ PERM, GIVPTR, GIVCOL, GIVNUM, WORK, IWORK, $ INFO ) * * -- LAPACK routine (version 3.1) -- * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. * November 2006 * * .. Scalar Arguments .. INTEGER CURLVL, CURPBM, CUTPNT, ICOMPQ, INFO, LDQ, N, $ QSIZ, TLVLS DOUBLE PRECISION RHO * .. * .. Array Arguments .. INTEGER GIVCOL( 2, * ), GIVPTR( * ), INDXQ( * ), $ IWORK( * ), PERM( * ), PRMPTR( * ), QPTR( * ) DOUBLE PRECISION D( * ), GIVNUM( 2, * ), Q( LDQ, * ), $ QSTORE( * ), WORK( * ) * .. * * Purpose * ======= * * DLAED7 computes the updated eigensystem of a diagonal * matrix after modification by a rank-one symmetric matrix. This * routine is used only for the eigenproblem which requires all * eigenvalues and optionally eigenvectors of a dense symmetric matrix * that has been reduced to tridiagonal form. DLAED1 handles * the case in which all eigenvalues and eigenvectors of a symmetric * tridiagonal matrix are desired. * * T = Q(in) ( D(in) + RHO * Z*Z' ) Q'(in) = Q(out) * D(out) * Q'(out) * * where Z = Q'u, u is a vector of length N with ones in the * CUTPNT and CUTPNT + 1 th elements and zeros elsewhere. * * The eigenvectors of the original matrix are stored in Q, and the * eigenvalues are in D. The algorithm consists of three stages: * * The first stage consists of deflating the size of the problem * when there are multiple eigenvalues or if there is a zero in * the Z vector. For each such occurence the dimension of the * secular equation problem is reduced by one. This stage is * performed by the routine DLAED8. * * The second stage consists of calculating the updated * eigenvalues. This is done by finding the roots of the secular * equation via the routine DLAED4 (as called by DLAED9). * This routine also calculates the eigenvectors of the current * problem. * * The final stage consists of computing the updated eigenvectors * directly using the updated eigenvalues. The eigenvectors for * the current problem are multiplied with the eigenvectors from * the overall problem. * * Arguments * ========= * * ICOMPQ (input) INTEGER * = 0: Compute eigenvalues only. * = 1: Compute eigenvectors of original dense symmetric matrix * also. On entry, Q contains the orthogonal matrix used * to reduce the original matrix to tridiagonal form. * * N (input) INTEGER * The dimension of the symmetric tridiagonal matrix. N >= 0. * * QSIZ (input) INTEGER * The dimension of the orthogonal matrix used to reduce * the full matrix to tridiagonal form. QSIZ >= N if ICOMPQ = 1. * * TLVLS (input) INTEGER * The total number of merging levels in the overall divide and * conquer tree. * * CURLVL (input) INTEGER * The current level in the overall merge routine, * 0 <= CURLVL <= TLVLS. * * CURPBM (input) INTEGER * The current problem in the current level in the overall * merge routine (counting from upper left to lower right). * * D (input/output) DOUBLE PRECISION array, dimension (N) * On entry, the eigenvalues of the rank-1-perturbed matrix. * On exit, the eigenvalues of the repaired matrix. * * Q (input/output) DOUBLE PRECISION array, dimension (LDQ, N) * On entry, the eigenvectors of the rank-1-perturbed matrix. * On exit, the eigenvectors of the repaired tridiagonal matrix. * * LDQ (input) INTEGER * The leading dimension of the array Q. LDQ >= max(1,N). * * INDXQ (output) INTEGER array, dimension (N) * The permutation which will reintegrate the subproblem just * solved back into sorted order, i.e., D( INDXQ( I = 1, N ) ) * will be in ascending order. * * RHO (input) DOUBLE PRECISION * The subdiagonal element used to create the rank-1 * modification. * * CUTPNT (input) INTEGER * Contains the location of the last eigenvalue in the leading * sub-matrix. min(1,N) <= CUTPNT <= N. * * QSTORE (input/output) DOUBLE PRECISION array, dimension (N**2+1) * Stores eigenvectors of submatrices encountered during * divide and conquer, packed together. QPTR points to * beginning of the submatrices. * * QPTR (input/output) INTEGER array, dimension (N+2) * List of indices pointing to beginning of submatrices stored * in QSTORE. The submatrices are numbered starting at the * bottom left of the divide and conquer tree, from left to * right and bottom to top. * * PRMPTR (input) INTEGER array, dimension (N lg N) * Contains a list of pointers which indicate where in PERM a * level's permutation is stored. PRMPTR(i+1) - PRMPTR(i) * indicates the size of the permutation and also the size of * the full, non-deflated problem. * * PERM (input) INTEGER array, dimension (N lg N) * Contains the permutations (from deflation and sorting) to be * applied to each eigenblock. * * GIVPTR (input) INTEGER array, dimension (N lg N) * Contains a list of pointers which indicate where in GIVCOL a * level's Givens rotations are stored. GIVPTR(i+1) - GIVPTR(i) * indicates the number of Givens rotations. * * GIVCOL (input) INTEGER array, dimension (2, N lg N) * Each pair of numbers indicates a pair of columns to take place * in a Givens rotation. * * GIVNUM (input) DOUBLE PRECISION array, dimension (2, N lg N) * Each number indicates the S value to be used in the * corresponding Givens rotation. * * WORK (workspace) DOUBLE PRECISION array, dimension (3*N+QSIZ*N) * * IWORK (workspace) INTEGER array, dimension (4*N) * * INFO (output) INTEGER * = 0: successful exit. * < 0: if INFO = -i, the i-th argument had an illegal value. * > 0: if INFO = 1, an eigenvalue did not converge * * Further Details * =============== * * Based on contributions by * Jeff Rutter, Computer Science Division, University of California * at Berkeley, USA * * ===================================================================== * * .. Parameters .. DOUBLE PRECISION ONE, ZERO PARAMETER ( ONE = 1.0D0, ZERO = 0.0D0 ) * .. * .. Local Scalars .. INTEGER COLTYP, CURR, I, IDLMDA, INDX, INDXC, INDXP, $ IQ2, IS, IW, IZ, K, LDQ2, N1, N2, PTR * .. * .. External Subroutines .. EXTERNAL DGEMM, DLAED8, DLAED9, DLAEDA, DLAMRG, XERBLA * .. * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. * .. Executable Statements .. * * Test the input parameters. * INFO = 0 * IF( ICOMPQ.LT.0 .OR. ICOMPQ.GT.1 ) THEN INFO = -1 ELSE IF( N.LT.0 ) THEN INFO = -2 ELSE IF( ICOMPQ.EQ.1 .AND. QSIZ.LT.N ) THEN INFO = -4 ELSE IF( LDQ.LT.MAX( 1, N ) ) THEN INFO = -9 ELSE IF( MIN( 1, N ).GT.CUTPNT .OR. N.LT.CUTPNT ) THEN INFO = -12 END IF IF( INFO.NE.0 ) THEN CALL XERBLA( 'DLAED7', -INFO ) RETURN END IF * * Quick return if possible * IF( N.EQ.0 ) $ RETURN * * The following values are for bookkeeping purposes only. They are * integer pointers which indicate the portion of the workspace * used by a particular array in DLAED8 and DLAED9. * IF( ICOMPQ.EQ.1 ) THEN LDQ2 = QSIZ ELSE LDQ2 = N END IF * IZ = 1 IDLMDA = IZ + N IW = IDLMDA + N IQ2 = IW + N IS = IQ2 + N*LDQ2 * INDX = 1 INDXC = INDX + N COLTYP = INDXC + N INDXP = COLTYP + N * * Form the z-vector which consists of the last row of Q_1 and the * first row of Q_2. * PTR = 1 + 2**TLVLS DO 10 I = 1, CURLVL - 1 PTR = PTR + 2**( TLVLS-I ) 10 CONTINUE CURR = PTR + CURPBM CALL DLAEDA( N, TLVLS, CURLVL, CURPBM, PRMPTR, PERM, GIVPTR, $ GIVCOL, GIVNUM, QSTORE, QPTR, WORK( IZ ), $ WORK( IZ+N ), INFO ) * * When solving the final problem, we no longer need the stored data, * so we will overwrite the data from this level onto the previously * used storage space. * IF( CURLVL.EQ.TLVLS ) THEN QPTR( CURR ) = 1 PRMPTR( CURR ) = 1 GIVPTR( CURR ) = 1 END IF * * Sort and Deflate eigenvalues. * CALL DLAED8( ICOMPQ, K, N, QSIZ, D, Q, LDQ, INDXQ, RHO, CUTPNT, $ WORK( IZ ), WORK( IDLMDA ), WORK( IQ2 ), LDQ2, $ WORK( IW ), PERM( PRMPTR( CURR ) ), GIVPTR( CURR+1 ), $ GIVCOL( 1, GIVPTR( CURR ) ), $ GIVNUM( 1, GIVPTR( CURR ) ), IWORK( INDXP ), $ IWORK( INDX ), INFO ) PRMPTR( CURR+1 ) = PRMPTR( CURR ) + N GIVPTR( CURR+1 ) = GIVPTR( CURR+1 ) + GIVPTR( CURR ) * * Solve Secular Equation. * IF( K.NE.0 ) THEN CALL DLAED9( K, 1, K, N, D, WORK( IS ), K, RHO, WORK( IDLMDA ), $ WORK( IW ), QSTORE( QPTR( CURR ) ), K, INFO ) IF( INFO.NE.0 ) $ GO TO 30 IF( ICOMPQ.EQ.1 ) THEN CALL DGEMM( 'N', 'N', QSIZ, K, K, ONE, WORK( IQ2 ), LDQ2, $ QSTORE( QPTR( CURR ) ), K, ZERO, Q, LDQ ) END IF QPTR( CURR+1 ) = QPTR( CURR ) + K**2 * * Prepare the INDXQ sorting permutation. * N1 = K N2 = N - K CALL DLAMRG( N1, N2, D, 1, -1, INDXQ ) ELSE QPTR( CURR+1 ) = QPTR( CURR ) DO 20 I = 1, N INDXQ( I ) = I 20 CONTINUE END IF * 30 CONTINUE RETURN * * End of DLAED7 * END