Lists and Linear Algebra

print

Lists and Linear Algebra


Using Lists in CindyScript


List are among the most fundamental and elementary concepts of CindyScript. In CindyScript lists serve several purposes. They serve as

  • enumerative arrays of objects
  • structured data arrangements
  • vectors
  • matrices

This section covers the very general aspects of creating lists and accessing their elements as well as all elementary aspects of array functionality. For information on all other aspects of lists, consult the sections





Creating Lists


Lists can be created very easily by placing the elements in square brackets, separated by commas. For example,

[45,12.5,123,2,5.5,5]

is a list of numbers.

["this", "is", "a", "list", "of", "strings"]

is a list of strings. Objects of different kinds can be mixed in a list:

["this", 3,"is",5 , "a",654, "mixed",234 , "list"]

Lists can also have lists as elements, and these can be nested arbitrarily.

[[4,6], ["a", "b"], 1, [4, "b", [23, "b"]], [ ]]

The last element [ ] of this list does not contain any elements. It is the empty list.

Alternatively lists consisting of at least two elements can also be enclosed by round brackets (...). This is sometimes convenient to have a more mathematical appealing notation in the the code. A three-dimensional vector may then be written as follows:

(7.3,9.3,-14.3)





Accessing Elements of Lists: take(<list>,<int>)



Description: One can access the individual elements of a list either with the infix operator <list>_<int> or the functional operator take(<list>,<int>). The indices start with number 1. If the index that should be accessed is less than 1 or greater than the number of elements in the list, then the value___is returned. Also, a warning message is issued on the console.


CodeResult
[2 ,5 ,7 ,3]_37
take([2 ,5 ,7 ,3],2)5
[2 ,5 ,7 ,3]_5___




The index can also be an arbitrary calculation. Furthermore, indices can access the nested parts of a nested list.

CodeResult
[ [2, [4,5]],1]_1[2,[4,5]]
[ [2, [4,5]],1]_(7-5)1
[ [2, [4,5]],1]_1_2[4,5]
[ [2, [4,5]],1]_1_2_25
[ [2, [4,5]],1]_1_2_2_2___



If a list is stored in a variable, the individual entries can be set after they are accessed by the _ operator. So for example, after the code fragment

a=[[2,[4,5]],1];
a_2="A"; 
a_1_2_1="B"; 


is evaluated, the value of a is [[2,["B",5]],"A"].

Advanced usage

The list element accessor has some other powerful options. By using negative numbers as indices one can access the list entries from the end to the beginning. The following examples exemplify this possibility:

CodeResult
[2 ,5 ,7 ,3]_(-1)3
take([2 ,5 ,7 ,3],(-3))5
[ [2,6] ,5 ,7 ,3]_(-4)_(-1)6




It is also possible to use lists of integers as indices. Then a list corresponding to the specified list entries is returned.

CodeResult
[2 ,5 ,7 ,3]_[2,3][5,7]
[2 ,5 ,7 ,3]_[-1,1,1][3,2,2]



Contributors to this page: von Gagern , Kortenkamp , Kohler and Richter .
Page last modified on Friday 27 of March, 2015 [08:38:58 UTC] by von Gagern.

The content on this page is licensed under the terms of the License.


Menu
free viagra samplehentai girlsmature pussymilfseeker cialis samplescam clip movie nude webcammother incest order viagra online cialis ukanime rapeparis hilton phone numbers viagra alternatives cialis forum cialis free samplehot girls in pantiesmonster of cocks discount cialis cilias free viagra samplesfree chat rooms cilia structurefree cartoon sex comics buy cialis order viagrafree adult videosplump girl gallerypantyhose gallerycum on her face cheapest cialisbisexual moviestampa bukakehuge black cock thumbnails buy cialis onlineporn star cialis drugwomen having sex cheap generic viagra alternative to viagra natural viagra cheap viagraoral sexteen webcam strip videosnude spanish girlserotic sex cams movies viagra side effectscartoon adultdisney sex animenude blonde hairygang bang swinger cialis viagrabisexual free moviesgay twinkswebcam chat live xxxyoung teens order cialislatina girls thongscum loversjapanese girl viagra cheapyoung japanese girlsmr chews asian beavergangbang squadshoshone indiansmature wiveslive webcam chat girlsfree ebony viagra on lineasian ladyboysteen boys viagra pillsself bondage techniques cailisincest familyfree ebony cheap cialisgay amateur cialis genericbusty asian viagra onlinemature breasts viagra for women free viagrabig boobies cialis generic viagragloryhole gaylatinas in thongs female viagraindian tits viagra 6 free samplesamateur upskirt viagra alternativefree xxx video cialis online discountgalleries of teen girls cialis dosage cheap generic cialisparis hilton pornopussy cat dollsbrutal sexgay peopleblack milfsno tits discount viagrablonde hairy pussyshemale animefree hardcore moviesmom strips for sonfat titscelebrity legsdouble anal levitra vs cialis cialis tadalafil cialis cheapgay bdsmcelebrities exposed viagra generic alternatives to viagra viagra canadabestialitypink porn stars viagra jokesclips of teen sexchicks suck horse cock online viagrasex with horsespainful analglory holes floridafree american bukkake cialis online buy viagrabig cock cum free cialisteen gay porn cialis side effects herbal viagra best price viagra purchase cialis cialis soft tabs cialis vs viagrafree fat girl webcamfree porn movie clipsoral penis suckingebony hardcore viagra pricepantyhose crossed legs cialis and levitralesbiennesblonde boobs buy viagra online