You have problems, and we're glad to hear them. Explain the problem, what you have tried, and where you got stuck.
Feel free to share a little info on yourself and the course.
Forum rules
Please respect your teacher's guidelines. Homework is a learning tool. If we just post answers, we aren't actually helping. When you post questions, be sure to show what you have tried or what you don't understand.
by Ehsan » Sun Aug 26, 2012 12:42 am
Hi everyone . I want to make an array inside a struct and randomly generate initial states.
-
Ehsan
-
- Posts: 8
- Joined: Thu Jul 12, 2012 7:39 am
by sylwester » Mon Aug 27, 2012 6:20 am
Too vague for me. What dialect are you implementing this in and what have you tried so far?
A general hunch is that you need to create the array then traverse it using a random function to give each slot a value. The fact that the array is in a struct is not very relevant.
-
sylwester
-
- Posts: 61
- Joined: Mon Jul 11, 2011 2:53 pm
by nuntius » Mon Aug 27, 2012 4:37 pm
If you are using defstruct, you will need to create a separate function to initialize the contents. If you are using defclass, then you can use "(defmethod initialize-instance :after" to do the initialization.
-

nuntius
-
- Posts: 452
- Joined: Sat Aug 09, 2008 10:44 am
- Location: Burlington, MA
Return to Homework
Who is online
Users browsing this forum: No registered users and 0 guests