|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Invisible wrote:
> (I've never tried this extensively, but I would suggest that it probably
> requires a little forethought before you start the calculation...)
Not too much. If you have the equation written down, the rule is that
you type in the numbers in the order they appear, and you type in the
operators as soon as you've gotten all the arguments for that operator.
Now, if it's not written down, it can take some head-twisting, but IME
not any more than using infix. Certainly easier than using infix without
parentheses built into the calcualtor.
--
Darren New / San Diego, CA, USA (PST)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>> (I've never tried this extensively, but I would suggest that it
>> probably requires a little forethought before you start the
>> calculation...)
>
> Not too much. If you have the equation written down...
I was thinking more if you're just casually throwing numbers around, and
you suddenly realise that you'd like to use the number on the top of the
stack as the *denominator*, not the numerator, or something like that.
If you know before hand exactly what computation you want to perform
then yes it's quite easy.
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Orchid XP v8 wrote:
> you suddenly realise that you'd like to use the number on the top of the
> stack as the *denominator*, not the numerator, or something like that.
I think there's a button for *that* case, actually.
--
Darren New / San Diego, CA, USA (PST)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>> you suddenly realise that you'd like to use the number on the top of
>> the stack as the *denominator*, not the numerator, or something like
>> that.
>
> I think there's a button for *that* case, actually.
Division and subtraction are the obvious ones. (Oh, and exponent if
there's a button for that.)
Thinking about it, a button to swap the top two operands ought to fix
most problems you might have.
I also anticipate that being able to somehow "inspect" the stack might
come in handy if you can't remember what you put on there already...
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Orchid XP v8 wrote:
> Thinking about it, a button to swap the top two operands ought to fix
> most problems you might have.
That's kind of what I was referring to, yes.
> I also anticipate that being able to somehow "inspect" the stack might
> come in handy if you can't remember what you put on there already...
Yes. I expect such a thing might have been around on some of the
calculators I remember seeing.
--
Darren New / San Diego, CA, USA (PST)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Fri, 15 Aug 2008 08:58:35 +0100, Invisible wrote:
> Nicolas Alvarez wrote:
>
>> JavaScript functions don't need names.
>>
>> var value = (function (x) {
>> return 3*x + 5;
>> })(42);
>>
>> That actually works.
>
> Ooo... that's interesting.
Python:
value = (lambda(x): 3*x+5)(42)
Lua:
value = (function(x) return 3*x+5 end)(42)
Ruby (1):
def test
yield 42
end
value = test { |x| 3*x+5 }
Ruby (2):
value = lambda { |x| 3*x+5 } .call(42)
C++0x:
int main()
{
int value = <>(int x) (3*x+5) (42);
}
(I would have tested this, but the build instructions
at http://parasol.tamu.edu/groups/pttlgroup/lambda/
don't work for me, tried to computers...)
i386 assembly (ok, this is cheating):
mov eax, 42
call over
lea eax, [eax*2+eax+5]
ret
over:
pop eax
call eax
mov [value], eax
--
Joel Yliluoma - http://iki.fi/bisqwit/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Joel Yliluoma wrote:
> Python:
>
> value = (lambda(x): 3*x+5)(42)
>
> Lua:
>
> value = (function(x) return 3*x+5 end)(42)
>
> Ruby (1):
>
> def test
> yield 42
> end
> value = test { |x| 3*x+5 }
>
> Ruby (2):
>
> value = lambda { |x| 3*x+5 } .call(42)
>
> C++0x:
>
> int main()
> {
> int value = <>(int x) (3*x+5) (42);
> }
>
> i386 assembly (ok, this is cheating):
> mov eax, 42
> call over
> lea eax, [eax*2+eax+5]
> ret
> over:
> pop eax
> call eax
> mov [value], eax
Haskell [is that cheating??]
value = (\x -> 3*x + 5) 42
Lambda calculus:
\i ->
(\n -> \m -> \f -> \x -> n f (m f x))
(
(\n -> \m -> \f -> \x -> n (m f) x)
(\f -> \x -> f (f (f x)))
i
)
(\f -> \x -> f (f (f (f (f x)))))
[I can't be bothered to write "42" in the lambda calculus. Suffice it to
say it contains 42 copies of the letter "f".]
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Joel Yliluoma wrote:
> C++0x:
>
> int main()
> {
> int value = <>(int x) (3*x+5) (42);
> }
I thought it was [], not <>.
But I don't have any C++0x compiler...
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Nicolas Alvarez <nic### [at] gmailcom> wrote:
> Joel Yliluoma wrote:
> > C++0x:
> >
> > int main()
> > {
> > int value = <>(int x) (3*x+5) (42);
> > }
> I thought it was [], not <>.
I suppose the exact syntax has still not been written to stone. The
current wikipedia article on the subject uses your syntax:
http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp wrote:
> I suppose the exact syntax has still not been written to stone. The
> current wikipedia article on the subject uses your syntax:
>
> http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions
>
It's not a feature I'm likely to use much, anyway. I'm more interested in
the range-based for loop (yes, I know it's pure syntax sugar), and template
concepts.
Currently:
for (std::vector<int>::iterator i = myList.begin(); i != myList.end(); ++i)
With the new type determination feature:
for (auto i = myList.begin(); i != myList.end(); ++i)
With the range-based for loop:
for (int &x : myList)
<3
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |