Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How do you use as an array as an argument

Reply
Thread Tools

How do you use as an array as an argument

 
 
Mark Rafn
Guest
Posts: n/a
 
      02-06-2007
>> (E-Mail Removed) <(E-Mail Removed)> wrote:
>> >I've already created classes for a variable (which includes a base
>> >(String) and int exponent).


>On Feb 6, 1:02 am, (E-Mail Removed) (Mark Rafn) wrote:
>> This makes little sense. A Variable should not have an exponent, it should
>> have exponents applied to it in various equations or operations. In the case
>> of 4x*x - 3x + 12 = 0, the Variable is "x". It has two different uses, with
>> different exponents.


http://www.velocityreviews.com/forums/(E-Mail Removed) <(E-Mail Removed)> wrote:
>I'm still relatively new to Java, so I only think I understood what
>you said, but there's a reason I want Tern to be a class and not
>implementable interface.


Cool. It's your code, you know best what you want out of it.

>A variable has a base and an exponent.


Not in any algebra I've used. A variable is a variable, and is combined with
coefficients and exponents to make an expression, which can be used in
equations and inequalities or evaluated for given values of the variable.
Picking nonstandard definitions of common words is usually a bad idea in class
design.

>5x^2*4b (the computer multiplies them together
>20bx^2


Pick a more complicated example.
(x-1)(x^2+1). This should become x^3 - x^2 + x - 1. Your evaluator will need
to know that "x" is a variable, and that it's the SAME variable with different
exponents applied in various places.

>I hope this has explained it enough so that you understand or can tell
>me why I'm wrong. Thank you.


I suspect you're going to dead end pretty quickly if you don't start with
standard mathematical concepts (variable, constant, operation) and work up
from there. It all depends on where you're going with it, though, and you
get to choose your own path.
--
Mark Rafn (E-Mail Removed) <http://www.dagon.net/>
 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      02-06-2007
"Oliver Wong" wrote:
>> I don't have any specific recommendations (everybody seems to recommend
>> the so called "Dragon Book", but I haven't read it myself,


Andy Dingley wrote:
> Anything in 2006 that really did require me to dust off my Dragon Book
> would also give me The Fear. It's a great book and everyone ought to
> read it sometime, but to actually _need_ it these days for any
> "typical" commercial coding problem makes me suspect that something
> about the intended solution is bizarrely over-complicating things.


Perhaps one doesn't need a full compiler, but LALR and recursive-descent
parsing is an incredibly useful tool for all kinds of applications.

Essentially, if you can express a data-processing task in EBNF, you can render
each "reserved word" of your grammar as a class or a method, and thus create a
threaded, single-pass processor. Some years back I used this approach to
create transformation routines between EDI messages and database transactions.
Even with Java 1.1 it could process something like 200,000 documents an hour
over a TCP connection.

- Lew
 
Reply With Quote
 
 
 
 
Andy Dingley
Guest
Posts: n/a
 
      02-08-2007
On 6 Feb, 22:56, Lew <(E-Mail Removed)> wrote:

> Essentially, if you can express a data-processing task in EBNF, you can render
> each "reserved word" of your grammar as a class or a method, and thus create a
> threaded, single-pass processor.


I already do something akin to this, I just do it very inefficiently
(with XSLT, and assuming an input that's already XML and thus
trivially parsed)

My problems these days are rarely about execution speed and far more
often about implementation speed. "Just about good enough" always
wins, so long as I can ship it yesterday. Certainly there's no reward
for a "good" solution because most businesses just don't have the
ability to recognise one.

(I'm not entirely happy about this, but it's where the jobs are).

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to use a passing argument(returned argument)? ؿ Ruby 7 11-27-2008 03:53 AM
Function pointers, variable argument functions calling other variable-argument functions (sort of) S?ren Gammelmark C Programming 1 01-07-2005 09:41 PM
How to pass variable argument list to another function w/ variable argument list? Ben Kial C Programming 1 11-15-2004 01:51 AM
defaulting argument to previous argument Bhushit Joshipura C++ 5 12-30-2003 03:21 PM



Advertisments