<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.sternwarte.uni-erlangen.de/wiki/index.php?action=history&amp;feed=atom&amp;title=Questions_and_Answers</id>
	<title>Questions and Answers - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.sternwarte.uni-erlangen.de/wiki/index.php?action=history&amp;feed=atom&amp;title=Questions_and_Answers"/>
	<link rel="alternate" type="text/html" href="https://www.sternwarte.uni-erlangen.de/wiki/index.php?title=Questions_and_Answers&amp;action=history"/>
	<updated>2026-05-03T12:45:42Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.7</generator>
	<entry>
		<id>https://www.sternwarte.uni-erlangen.de/wiki/index.php?title=Questions_and_Answers&amp;diff=695&amp;oldid=prev</id>
		<title>Stierhof: copy from old wiki</title>
		<link rel="alternate" type="text/html" href="https://www.sternwarte.uni-erlangen.de/wiki/index.php?title=Questions_and_Answers&amp;diff=695&amp;oldid=prev"/>
		<updated>2018-04-11T12:04:41Z</updated>

		<summary type="html">&lt;p&gt;copy from old wiki&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=== How can I find out which function/line in my code is causing a stack overflow? ===&lt;br /&gt;
You can use the package '''''stkcheck''''' and activate the function '''''enable_stack_check()''''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require(&amp;quot;stkcheck&amp;quot;);&lt;br /&gt;
enable_stack_check();&lt;br /&gt;
  &lt;br /&gt;
printf(&amp;quot;Guess how many characters were written...\n&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
This will show in which line/functions values are left on the stack:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Guess how many characters were written...&lt;br /&gt;
&amp;lt;stdin&amp;gt;:4: 1 object(s) left on the stack&lt;br /&gt;
42&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You have to know that in S-Lang, you have to explicitly catch all return values of the functions you're calling.&lt;br /&gt;
In case you're not interested in the return value, discard it by assigning it to an empty pair of parentheses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
()=printf(&amp;quot;I don't care about the number of bytes written!\n&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;  data-expandtext=&amp;quot;show&amp;quot; data-collapsetext=&amp;quot;hide&amp;quot;&amp;gt;&lt;br /&gt;
====== More information for experts ======&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
S-Lang functions may have more than one return value. A trivial example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
define sum_and_product(a, b)&lt;br /&gt;
{&lt;br /&gt;
  return (a+b, a*b);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
(s, p) = sum_and_product(a0, b0);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One selectively discard ''some'' return values, or also ''all of them'',&lt;br /&gt;
by using according empty places in the comma-seaparated list of variables inside the parentheses:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(s,  ) = sum_and_product(a0, b0);&lt;br /&gt;
( , p) = sum_and_product(a0, b0);&lt;br /&gt;
( ,  ) = sum_and_product(a0, b0);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in versions of S-Lang prior to [http://www.sternwarte.uni-erlangen.de/~hanke/git.slang/?p=S-Lang;a=commit;h=11dab02ad2f43a22337f8a06d9e2938ceead03a4 pre2.2.4-7],&lt;br /&gt;
qualifier values were confused with values left on the stack,&lt;br /&gt;
such that &amp;lt;tt&amp;gt;enable_stack_check()&amp;lt;/tt&amp;gt; would complain in any case.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== How can I read CSV files? ===&lt;br /&gt;
CSV files are Comma-Seperated Variable ASCII files, which are easily read into ISIS using the &amp;lt;tt&amp;gt;ascii_read_table&amp;lt;/tt&amp;gt; function. For each value in your file you have to give the format plus the separator to the next value, i.e., a comma (&amp;quot;,&amp;quot;).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable dat = ascii_read_table(&amp;quot;lc.csv&amp;quot;, [{&amp;quot;%F,&amp;quot;,&amp;quot;time&amp;quot;},{&amp;quot;%F,&amp;quot;,&amp;quot;rate&amp;quot;},{&amp;quot;%F&amp;quot;,&amp;quot;err&amp;quot;}]) ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This returns a structure &amp;lt;tt&amp;gt;dat&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
dat = struct{Double_Type time, Double_Type rate, Double_Type err}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or you can use the presumably better &amp;lt;tt&amp;gt;csv&amp;lt;/tt&amp;gt; routines in ISIS, which you can get access to by &amp;lt;tt&amp;gt;require(&amp;quot;csv&amp;quot;)&amp;lt;/tt&amp;gt;. You can then read your data using&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
reqiuire(&amp;quot;csv&amp;quot;) ;&lt;br /&gt;
variable dat = csv_readcol (&amp;quot;lc.csv&amp;quot; ; type=['d','d','d'], fields = [&amp;quot;time&amp;quot;, &amp;quot;rate&amp;quot;, &amp;quot;err&amp;quot;]) ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
which returns the same structure as above. Note that &amp;lt;tt&amp;gt;type&amp;lt;/tt&amp;gt; needs to be an array of &amp;lt;tt&amp;gt;UChar&amp;lt;/tt&amp;gt;s, so single quotes only. Without the &amp;lt;tt&amp;gt;type&amp;lt;/tt&amp;gt; qualifier the fields of &amp;lt;tt&amp;gt;dat&amp;lt;/tt&amp;gt; will be &amp;lt;tt&amp;gt;String_Type&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
See the documentation of &amp;lt;tt&amp;gt;csv_readcol&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;csv.readcol&amp;lt;/tt&amp;gt; for further information.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Isis / Slang]]&lt;/div&gt;</summary>
		<author><name>Stierhof</name></author>
	</entry>
</feed>