]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.runtime/src-isv/GettingStarted.mediawiki
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.scl.runtime / src-isv / GettingStarted.mediawiki
1 [[Category: Simantics Constraint Language]]
2 == Getting started ==
3
4 The easiest way of getting started with SCL is to use SCL console that is included in almost all Simantics-based products. You can open the console by pressing ALT-SHIFT-q and then q and choosing "SCL Console" from the list of views.
5
6 SCL console works by executing commands you write into the input box in the bottom of the view. After the command has been written, it can be executed by pressing ENTER. However, this works only if the command contains no syntactic errors. Possible errors are highlighted in the input box and a description of the error is shown when you move mouse on top of the highlighted text.
7
8 Multiline commands can be written by pressing CTRL-ENTER (or just ENTER when the current command text contains errors). The command history can be browsed with CTRL-UP and CTRL-DOWN.
9
10 If the command you write into console results as an ordinary value, it is just printed to the console. Here are couple of examples you can try:
11 <pre>
12 > 13
13 13
14 > 1+2
15 3
16 > sin 1
17 0.8414709848078965
18 > "Hello " + "world!"
19 Hello world!
20 > [1,3,5]
21 [1, 3, 5]
22 </pre>
23
24 You can also declare local variables to be used in the commands:
25 <pre>
26 > x = 35
27 > y = 40
28 > x + y
29 75
30 > x * y
31 1400
32 </pre>
33
34 Also new functions can be defined:
35 <pre>
36 > f x = x * x
37 > f 123
38 15129
39 </pre>
40
41 If you write a command that has side-effects, it is executed in the console:
42 <pre>
43 > print "Hello" ; print "world!"
44 Hello
45 world!
46 </pre>
47
48 SCL is a dialect of Haskell and tutorials written for Haskell can be used for learning the details of the language. The main differences between the languages are the strict evaluation strategy used in SCL and somewhat different standard library. Some Haskell tutorials can be found at [http://www.haskell.org/haskellwiki/Learning_Haskell http://www.haskell.org/haskellwiki/Learning_Haskell].
49