[Flightgear-devel] Re: Nasal advice...

2005-04-25 Thread Melchior FRANZ
* Andy Ross -- Monday 25 April 2005 16:01: > setprop(name, setbit(getprop(name), 2)); > > Look more elegant than bit twiddling to my eyes... I found a better solution already. Thanks. > > The problem is that in joystick files I don't have the > > possibility to initialize bit fields or defin

Re: [Flightgear-devel] Re: Nasal advice...

2005-04-25 Thread Andy Ross
I wrote: > Write a function to [...]. Compose them appropriately to set bits > in numbers. Probably four lines of code, Turns out it's three lines of code: n2s = func(n) { var s = buf(6); setfld(s, 0, 48, n); return s; } getbit = func(n, b) { getfld(var s = n2s(n), b, 1) } setbit = func(n

Re: [Flightgear-devel] Re: Nasal advice...

2005-04-25 Thread Andy Ross
Melchior FRANZ wrote: > Wouldn't work in my case. Would only make it even less > elegant. Then I better stick with this: Only if you don't want to write your own functions (in which case every feature I don't want to support is going to be inelegant and you'll never win until I turn Nasal into ano

[Flightgear-devel] Re: Nasal advice...

2005-04-25 Thread Melchior FRANZ
* Melchior FRANZ -- Monday 25 April 2005 08:47: > The problem is that in joystick files I don't have the possibility to > initialize bit fields or define bit operations. Bindings in joystick > files are executed in "random" order. None is guaranteed to be triggered > at the very beginning. (Althou

[Flightgear-devel] Re: Nasal advice...

2005-04-24 Thread Melchior FRANZ
* Andy Ross -- Monday 25 April 2005 04:20: > Melchior FRANZ wrote: > > I'm still hoping for binary ops [...] > What I'm thinking about instead is a "bits" package with functions > like: > >bits.fld(string, startbit, len) [...] >bits.buf(len) >Creates a new, mutable string filled

Re: [Flightgear-devel] Re: Nasal advice...

2005-04-24 Thread Andy Ross
Melchior FRANZ wrote: > I was thinking |A| (value of A), but I'm still hoping for binary > ops, so this isn't a good idea. Function sounds good. Bit operations as syntax aren't coming. All numbers in Nasal are floating point, and don't mix nicely with bit twiddling. What I'm thinking about inste

RE: [Flightgear-devel] Re: Nasal advice...

2005-04-24 Thread Vivian Meazza
Melchior FRANZ > * Vivian Meazza -- Sunday 24 April 2005 20:41: > > Andy Ross wrote > > >`A` @A $A %A &A @"A" $"A" %"A" &"A" c"A" > > > > Anything but `A` - I'm bound to misread that in the future sometime. I > > favour a function. > > Hmm ... and I changed my mind and wou

Re: [Flightgear-devel] Re: Nasal advice...

2005-04-24 Thread Erik Hofman
Melchior FRANZ wrote: Alternatively, take TeX's syntax: `\A ... for extra geek points. ;-) If you are really seeking for ggek points: $eq1 = "2 * $val"; $eq2 = "-7 + $val"; test_val = (1 < (3 + #"-3 * ${want_eq1 ? $eq1 : $eq2}"); :-) Erik ___ Flightgea

[Flightgear-devel] Re: Nasal advice...

2005-04-24 Thread Melchior FRANZ
* Vivian Meazza -- Sunday 24 April 2005 20:41: > Andy Ross wrote > >`A` @A $A %A &A @"A" $"A" %"A" &"A" c"A" > > Anything but `A` - I'm bound to misread that in the future sometime. I > favour a function. Hmm ... and I changed my mind and would now find `A` a reasonable choi

[Flightgear-devel] Re: Nasal advice...

2005-04-24 Thread Melchior FRANZ
* Erik Hofman -- Sunday 24 April 2005 19:53: > At first I was thinking using #'A' since # represents a number already > in most cases, but then again; how about just using a new function? I was thinking |A| (value of A), but I'm still hoping for binary ops, so this isn't a good idea. Function sou