Spin slang?
cavelamb
Posts: 720
Where did := come from?
I've not seen that in other languages (but I may be a few years out of date now).
I've not seen that in other languages (but I may be a few years out of date now).
Comments
-Phil
Looking for := by itself turned up nada...
2. Assignement :=
3. Test for equality ==
These not only help to disambiguate expressions, but they help to make sure that you mean what you've written.
-Phil
**=, /=, //=, ~>=<<= >>= <-=, ><=, &=, |=, ^=, AND=, OR=, <>=, <=, >=, =<= and =<=
Oh, and =>, =<
and finally <>, which is the only "equals" operation that does not use the "=" character.
If SPIN used (F)LEX and YACC for the lexer and tokenizer, then = and := are free and require no overhead. However, since the compiler is written long-hand, it requires additional tokens and checks.
= is assignment
== is evaluation
=== is evaluation and type checking
=== in PHP basically says "if A evaluates to the same value as B and they have the same type, then the expression is true". This only matters when you have trinary: True, False, and NULL. In PHP a NULL evaluates to False and non-existent evaluates to False. If you compare values and one of them is not defined/declared, it can be detected with === instead of the more obvious isset() or isempty(). Also, if you are trying to detect a type mismatch in your data, the === operator is useful.
Not and Not not?
But other than that (and the indentation forming the structure - for an hour or so) Spin seems usable.
I got Blinky running - with a button that changes the blink rate - in one evening.
The obvious problem (in hind sight) was that waitCnt took 58 seconds or so no matter what - until I started indenting to make the structure clearer.
Then I noticed what was happening.
Cute. Really cute... it does work though.
I haven't started playing with Assembly yet.
What I've seen in the examples looks right readable.
It's an interesting platform.
I have a couple of projects in mind, but I don't know how "interesting" they would be to the rest of the world.
First one is a simple thing... a ships bell.
I'm a sailor, and while the geek in me appreciates Christopher Miller's sailboat, "Spin",
I'd rather just sail the boat my own bad self. I'm not anti-geek at all, but I appreciate
simplicity a lot more these days. However, simplicity can mean many things.
Taken to an extreme it could mean no gadgetry at all (Ludism wrote small?),
or in moderation it might mean simplicity of operation.
I like the latter. It lets me use the GPS and autopilot without internal conflict.
I'd like to have the bells aboard my boat. (and at home too, but especially aboard the boat)
It marks the passage of time through the day.
Waste of processor power, maybe, but that's my first gig.
Bells.
I see two approaches.
First is the simplest, hit a real brass bell with a real solenoid driven hammer.
Nothing sweeter than the hard attack and slow decay of a real brass bell.
Make a nice walnut base to hide all the bytes and bits...
M'lady might even let me keep it in the house?
The other is to digitize that sound and and play it back - wave or MP3 style.
Maybe not as nice to look at, but there are some important advantages.
Either way, time keeping is at the heart of the project.
To that end I've been studying the RTC modules available.
I bought a DS1307 module from Sparks and have been reading driver code for it.
(BTW, bless all who have posted their works in the Object Exchange! You guys rock!)
Should be a straight forward job on a Parallax Proto board - with a 5 volt regulator on board.
I2C or SPI, doesn't seem to make much difference in this limited application.
Our pins runneth over.
But now I'm thinking power supplies, and think that maybe the thing could run from batteries.
I have to look mode closely at the 3.3 volt chips like the Dallas DS3234.
Sparkfun has one, and Adafruit has their ChronoDot.
The stumper for a long time was how to set the time - with minimal extra circuitry.
Minimal.
That means (to me) no display, no keyboard, no handy computer, no smart phone, and no extra IQ required.
I figured it out, one bit, and it's a traditional naval solution to boot!
The next problem to solve (for the block 1 project) is the hammer actuator.
A solenoid is the most obvious choice, but a suitable one seems to be illusive at present. Still looking there.
I almost think there is a way to do it with a servo and rubber band (or spring), but I haven't really worked it out yet.
The two strokes a second apart gets to be a challenge using something that slow.
For block 2, recording the sounds and massaging them into something compatible could be just as challenging.
And probably a lot more frustrating too. That's a pure ignorance issue on my part.
What works with what?
But it would make a more compact and self contained unit.
And less strenuous power supply issues to boot.
I bought a Gadget Ganster Platform USB board for that one since it has an on-board SD card socket.
That long rolling decay ain't gonna fit in any 32k of EEPROM space.
Oh well, it keeps me busy.
And it really is an interesting platform...
Since you don't expand on this, I'll have to assume that you're tapping into the NMEA data bus in your equipment box and grabbing GPS timestamp data.
5 volts, or 36 volts? You may wan to look into some of the Karplus-Strong synthesis that's been discussed on this forum. That actually sounds like fun.
I have one of those too!
I love my blinky LED.
It even does trick (that's like tricks, but it only has one)
The propeller is actually better at synthesis than it is at audio playback.
It's all in the attach, sustain and decay.
If there is a guru that can explain ot in simple terms, I'll sit and learn.
Since you don't expand on this, I'll have to assume that you're tapping into the NMEA data bus in your equipment box and grabbing GPS timestamp data.
NEMA??!!!?!?! ROTFLMAO!
Nope! I mean seriously - THAT'S some serious extra circuitry.
No, what I have in mind is a single bit.
Although one could use a sextant if necessary, but it's still just one bit.
Cluso will get it.
5 volts, or 36 volts?
Oh golly, 6 volts off of a battery pack?
The boat's electrical system is 12 volts but I'd really prefer it to be more portable than that.
You may wan to look into some of the Karplus-Strong synthesis that's been discussed on this forum.
Haven't seen it yet, but will look it up.
Thanks.
Another possibility is a small MP3 player? I saw one posted here the othe night.
No - on a technicality.
It doesn't "allow us to find when noon is". But warm. Very warm.
The naval day begins at noon - because that is the only time of the day that one can be sure of at sea.
By observing the sun's altitude (with a sextant) we can determine the exact time of local noon.
The sun rises, then rises no more, then she starts back down...
Now note that this is local noon. Very important.
Because the time hack on the WWV radio hack (or even GPS, I think) is Greenwich time - not local.
To do anything other than sun-visible-or-not, you'd also need to know what angle the sextant is set to, so that's a lot more than 1 bit, isn't it?
Nope. Well, not if you can use a sextant. Or a watch.
Which is, by my own rules, cheating, I guess. The watch anyway.
No, just one button - press it at noon.
Code sets the RTC chip to - noon - when pressed.
That would indeed be something to see!
Check out the history of John Harrison - clock maker...
http://en.wikipedia.org/wiki/John_Harrison
The sextant hasn't changes much since the 18th century.
But time keeping sure has.
-Phil
Basically the distinction is between declarative and imperative programming, its actually pretty important theoretically and in real compilers on real hardware.
The truth is that := was the assignment operator in nearly all computer languages except Fortran. Then C came along and borrowed Fortran's syntax. The ":=" operator is designed to be read as "set equal to", where as "=" reads as "equals"... The Algol family also had the LET statement to introduce 'constant' variables using '=' rather than ':=' ie "LET a = b * 2 ;" (which is not an assignment).