map with multiple inputs

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

It looks like the map command does not support multiple inputs to the specified function:

This is from http://www.cs.berkeley.edu/~bh/v1ch5/hof.html :

but just produces a "number expected" error.

 

Live and learn, Andreas

 

Andy
Andy's picture
Offline
MathematicianTechnologistProfessional Blogger
Joined: 02/10/2010
MAP fixed

Thanks to Joshua who fixed the MAP with multiple inputs.

Closed #84 via f151912.

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

Thanks for following up !

Andy
Andy's picture
Offline
MathematicianTechnologistProfessional Blogger
Joined: 02/10/2010
one-input

Further reading in the http://www.cs.berkeley.edu/~bh/v1ch5/hof.html :

Map takes two inputs. The first is a word, which must be the name of a one-input Logo operation. The second can be any datum. The output from map is either a word or a list, whichever is the type of the second input. The members of the output are the results of applying the named operation to the members of the second input.

? show map "first [Rod Argent]
[R A]

The Logo command SUM has two inputs, therefore it output as expecting another number because it does SUM 1 and it needs another number.

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

And further on the page there is the example with multiple inputs which seems useful.

Andy
Andy's picture
Offline
MathematicianTechnologistProfessional Blogger
Joined: 02/10/2010
Logo interpreter

Hmm.. this is probably a bug in the original Logo interpreter http://www.calormen.com/jslogo/ by Joshua Bell. I will see if I can fix it, or I will post this issue to Joshua at https://github.com/inexorabletash/jslogo

PS: Thanks for testing :-) Are you having another project in mind that will use MAP command? 

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

In the jslogo provided manual map does take only one list, but an issue github could be good to document the behaviour.

I had planned on using map with multiple input for adding vectors in the same way as the example. I wanted to add all positions around the gear  to average them in roder to find the center. Then, I found it more useful to generate gears around the origin in the first place, so this was not necessary anymore. But adding vectors seems useful in general for logo.

Andreas