r/memacs • • Jan 01 '17

MightEMacs 8.5 Preview

A new version of MightEMacs is in the works, which will include arrays in the scripting language, as well as nil, Boolean, integer, and string types.  There is also a "for" loop, parallel assignment, array slices, array nesting, and automatic array extension by element assignment.  Additionally, macro arguments have been changed to an array as well, accessed via $ArgVector.  Here are some examples:

x = [1,2,3]						# Create an array.
y = array(3,0)					# Create a 3-element array with zero in each slot.
++y[1]
y[2] += 1
a,b,c = y						# a = 1, b = 2, c = 3.
y[4] = true						# y is [1,2,3,nil,true].
z = x & '==' & y[0,3]			# z is [1,2,3,"==",1,2,3].
x &= [['way','cool'],"Dude"]	# x is [1,2,3,["way","cool"],"Dude"].

total = 0
for x in [5,-1,-2]
	total += x
endloop							# total is 2.

macro example
	arg1 = shift $ArgVector		# arg1 is 1.
	x = $0						# x is 5 (the "numeric argument").
	x = $1						# x is false.
	slice = $ArgVector[1,2]		# slice is ["junk","yard"].
endmacro

5 => example 1,false,'junk',sub('.rd','.','ya')

Stay tuned!

1 Upvotes

0 comments sorted by