Scolring - Forum

Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology

Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered

You are not logged in.

#1 Re: Programing » Compare numbers negatives in scol? » 6-Jan-2019 14:06:17


Hi !

Several errors in your code.

You should never compare floats in this way, in Scol nor any other language.

To compare two integers, it's ok :

if integer1 == integer2 then

To compare two floats, you compare the difference with an epsilon whose accuracy you arbitrarily choose.

if (float1 -. float2) <. epsilon then
  _fooS "they are equals"
  _fooS "They are not equals";

You should use the float Scol library : … float.html (doc)

Your code could be this in h/a.pkg :

fun main()=
	let  atof "$9" -> x in
	let " " -> temp_x in
	if std_fCmp x (-.255.0) then
		set temp_x = ftoa (-.1.0)
		set temp_x = ftoa 0.0;;

Called by a such script :

_load "lib/std/float.pkg"
_load "h/a.pkg"

I use std_fCmp function. By default, epsilon is 0.000001.

You write :

if x =. -255.0 then

Also, = sets a value to a variable, so if x = 255.0 then sets 255.0 to x and the expression tests the return value of set, a side effect. This is an equivalent of if set x = 255.0 then ...
if x =. 255.0 then, with a point, create a syntax error : this is no sense in Scol. It's contrary to its grammar.
In a test, you must double the equal sign but with the float numbers, this is wrong (see above).

Next, -255.0 is wrong. Indeed, - (without point) expects an integer.
-. (with point) expects an float, thus (-.255.0) is correct.

If you want compare an integer and a flot, you must convert the integer to float (or the other way around but your can lost the precision)

Then, your variable named x is stange :

let  atof "$9" -> x in 

will always give 0.000000. I guess you wish to get the value of $9, maybe a parameter into a string ?

#2 Re: Programing » playing around with building grids out of strings » 19-Nov-2018 16:17:41

hebdemnobad wrote:

scol throws an error, I assume because I am adding an element that comes after the end of the tail of the list, which is nil.


hebdemnobad wrote:

I'm also curious as to what:

Expected: fun [[[r1 r1] r1] [r1 r1] I] [r1 r1]

The compiler is too crazy sometimes ...
[r1 r1] does not exist. It's senseless.
A recursivity level 2 can be exist (even level n but this is no utility in practice). By example : [S I r2]

To add an element at the end, you can see in 'lib/std/list.pkg' : there is not function for that but std_lApplyFunc could be a start.

#3 Re: Programing » playing around with building grids out of strings » 18-Nov-2018 23:02:32


Hello !

proto build_line_return_string = fun[[S r1] I I S]  S;;
proto make_string_list =  fun [S [S r1] I ] [S r1];;

fun make_string_list(element, list, iterations) =
	let 0 -> counter in
	while (counter < iterations) do
		set list = element::list;

fun build_line_return_string (list, multiplier, counter, output_string)=
	//end of list, return full string
	if ((hd list) == nil) then
	//not end of list yet
	if ((mod counter multiplier) == 0) then
		//add head of list to end of string, add line return since we are at a multiple of multiplier that 
                //determines line length and 
                //feed tail of list and changed string back into function
		set output_string = strcatn output_string::(hd list):: "\n"::nil;
		build_line_return_string tl list multiplier counter output_string;
		//add head of list to end of string followed by a space, feed tail of list 
		//and changed string  back into function
		set output_string = strcatn output_string::(hd list)::" "::nil;
		build_line_return_string tl list multiplier counter output_string;
fun main()=
	let 100 -> iterations in
	let make_string_list "vv" nil iterations -> string_list in
	_fooS build_line_return_string string_list 7 1 nil;

I just add few very minor changes. To be continued ...

I don't know what you want to do next...
you can try to write a more polymorphic package: for example, a list of any objects with a tuple of coordinates instead of string ? Or not ! smile Cool to see you again

#5 Re: Programing » Reduce size of app » 1-Sep-2018 17:58:25



An OS3D's app or a Scol's app ?

#6 Re: Openspace3D » see the app script/code » 20-Aug-2018 20:36:42

iri is a better choice.
Or go to the the Scolring home page ( then click on "Development server"

#7 Re: Pub - Café » Questions about SCOL » 6-Aug-2018 22:21:11


If this is only an OS3D's applet, but if this is an application written in Scol (that was the question), the source code must be provided. smile
Same thing for Scol itself.

#8 Re: Pub - Café » Questions about SCOL » 6-Aug-2018 13:06:11

arkeon wrote:

yes smile

and you must freely provide the source code of your Scol's app.
For more informations, see the license file

You can sell it for any price if you have buyers.

#11 Re: Openspace3D » Set Dialog position » 11-Jul-2018 12:25:02


You can't with this plugin.

Nota : I moved your last threads from "Programing" to "OpenSpace3D"

#12 Re: Projects » Tirage au sort » 9-Jul-2018 16:37:15


Hohoo, cool smile)

Outre une vidéo, je serais curieux de voir ce que tu as fait, tant dans les modifs d'OS3D que dans la prog de la carte Arduino. Publieras-tu sur ces sujets ?

#13 Re: Openspace3D » Problem creating a plugin to run .bat » 5-Jul-2018 14:43:31


They remain a security issue. I never liked this. But it can be convenient

#14 Re: Openspace3D » Vidéo qui freeze » 30-May-2018 09:02:04


C'est assez caractéristique d'un encodage mal pris en charge ? Comme évoqué, tester avec des vidéos sous un autre encodage.

#16 Re: Pub - Café » Hello la communauté Openspace 3D » 6-Mar-2018 18:59:06


et ne pas hésiter à en parler autour de vous ! ;-)

#17 Pub - Café » 2018 » 2-Jan-2018 14:33:15

Replies: 2

Hello !

Happy and prosperous new year !
New projects, new apps, new news ... big_smile

Have phun !

#20 Re: Openspace3D » Date format of Screenshot PlugIT » 13-May-2017 14:00:37


Your code is correct.
Several different ways exist for this. Here, i use functions and sprintf :

fun getZeroIfAny (iData)=
	strcat if iData < 10 then "0" else "" itoa iData;;

fun getOnly3d ()=
	if only3d then ".png.jpg" else ".jpg";;

fun cbTakeShot (inst, from, action, param, rep, p) =
	let sprintf "%s%d%s%s_%s%s%s%s"
			[filePrefix 		// %s
			year 			// %d
			getZeroIfAny month 	// %s
			getZeroIfAny day 	// %s
			getZeroIfAny hours 	// %s
			getZeroIfAny minutes 	// %s
			getZeroIfAny seconds 	// %s
			getOnly3d]  		// %s
	-> file in

It may be more readable but this is subjective.
(i don't check its validity, it might be easily adapted)

#23 Re: Openspace3D » openspace 3d Error » 11-Mar-2017 10:28:17


This is probably related to the error under Wine

#24 Re: Openspace3D » Install Issue » 8-Feb-2017 09:26:54


8 Go ! You did not install a copy of the source code (by subversion by example) ? Only the "setup" ?

Board footer

Powered by FluxBB