butfirst "mystring returns list

  • Email
  • Sharebar
  • Email
4 replies [Last post]
aplesch
aplesch's picture
Offline
MathematicianScientistTechnologistRegular Blogger
Joined: 05/10/2015

In the console

show bf "123

returns a list

[23]

However, it should return a string.

In the console at http://calormen.com/jslogo/ the same command returns 23 wich seems more correct.

Andy
Andy's picture
Offline
MathematicianTechnologistProfessional Blogger
Joined: 02/10/2010
logo updated

I have just updated the VRMath2 logo with current jslogo. The problem should have been fixed, and hopefully no other complications to my 3D turtle graphics. smiley

aplesch
aplesch's picture
Offline
MathematicianScientistTechnologistRegular Blogger
Joined: 05/10/2015
fixed

I can confirm that the problem is fixed. I wanted to use this in a recursive function but then found another way. Anyways, it looks like recursively going through large lists or words does not work too well since firefox complains then about 'too much recursion'. jslogo does not put restriction on recursion depth, I think, but javascript in firefox has limits.

 

Andy
Andy's picture
Offline
MathematicianTechnologistProfessional Blogger
Joined: 02/10/2010
The maximum call stack size

jslogo is certainly limited by the javascript and the browser's maximum call stack size. Every browser has different sizes of call stack. General suggestion (from reading) is to avoid deep recursion. Some says that ECMAScript 6 will have better recursion (tail call optimisation). I found the following links intersting to read.

http://programmers.stackexchange.com/questions/179863/performance-recurs...

http://stackoverflow.com/questions/9474465/is-iteration-faster-than-recu...

http://jsperf.com/fibonacci-recursive-or-iterative/10

http://jsperf.com/iterative-vs-recursive-method-invocation/3

Isn't ES6 supported by Firefox already or perhaps not in the version 38 you are using? Do you still have to use the older Firefox? and so the VRM2 with old codemirror?

aplesch
aplesch's picture
Offline
MathematicianScientistTechnologistRegular Blogger
Joined: 05/10/2015
performance

Thanks for the links. On firefox 41.0 on my home laptop the iterative methods on jsperf are about a factor of four faster.