1

I want to input a probability value in the code through a slider. The name of the slider is lawful-industry with a value range from 0 to 1, so the code I wrote is:

 [let probs [["lawful" lawful-industry]["unlawful" 1 - lawful-industry]]

but NetLogo outputs "Expected a literal value". What is wrong?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Javier Sandoval
  • 507
  • 3
  • 18

1 Answers1

2

Can you give more context for this code? What are you expecting probs to be in this example- a list of lists? If that's the case, you need to use the list primitive since you are making a list from interface inputs. Try this:

to test
  let probs list ( list "lawful" lawful-industry ) ( list "unlawful" ( 1 - lawful-industry ) )
  print probs
end

Output (when lawful-industry is 0.37):

[[lawful 0.37] [unlawful 0.63]]
Luke C
  • 10,081
  • 1
  • 14
  • 21