forall for (x) print secname(), x forall for (x,0) print secname(), x // leave out 0 and 1, i.e. the 0 area nodes
begintemplate Temp public str, obj, x strdef str objref obj x = 0 endtemplate Temp objref temp temp = new Temp() temp.x = 2 temp.str = "hello" temp.obj = new SectionList() print temp, temp.x, temp.str, temp.obj
begintemplate P public flush, plot, begin, view_count objref this proc flush() { print this, "flush", t } proc plot() { print this, "plot", t } proc begin() { print this, "begin", t } func view_count() { print this, "view_count" return 1} endtemplate P flush_list.append(new P()) // call flush every step graphList[0].append(new P()) // call plot and flush every step
/* // The standard run library includes this template which defines a String class: begintemplate String public s strdef s proc init() { if (numarg() == 1) { s = $s1 } } endtemplate String */ objref sobj[5] for i=0, 4 sobj[i] = new String() for i=0, 4 sprint(sobj[i].s, "Number %d", i) for i=0, 4 print sobj[i].s
/* Previous example used "array" notation to manage a collection of Strings, but it is more flexible to use Lists to manage collections of objects-- see comments below. For more see Programmer's Reference documentation of List */ objref slist slist = new List() for i=0, 4 slist.append(new String()) for i=0, slist.count()-1 sprint(slist.o(i).s, "Number %d", i) // iteration is simpler--never have to remember how many there are for i=0, slist.count()-1 print slist.o(i).s // can always add more by appending (shown here) or inserting slist.append(new String()) slist.o(slist.count()-1).s = "another one" for i=0, slist.count()-1 print slist.o(i).s // can delete any, and iteration will still work properly slist.remove(3) for i=0, slist.count()-1 print slist.o(i).s
hoc_obj_.c.printf
hoc_obj_.c.deriv(1,1).printf
hoc_obj_.c.deriv(1,1).indvwhere(">", 1e-5).printf
hoc_obj_.ind(hoc_obj_.c.deriv(1,1).indvwhere(">", 1e-5).add(1)).printf
hoc_obj_[1].ind(hoc_obj_.c.deriv(1,1).indvwhere(">", 1e-5).add(1)).deriv(1,1).printf
The following aren't hoc idioms, but they can be helpful.
These EMACS commands work for command line editing
from the console (MSWin: NEURON's interpreter window).
^P previous line (up arrow may also work; this crude history function can be applied repeatedly to scroll through prior commands)
^A front of line
^E end of line
^B backward character
^F forward character
Long command lines can be constructed by revision + accretion
(recall a prior line, make changes and add new stuff to it).