ghorn / chart-gtk-example

temporary repository for a chart-gtk example
1 stars 2 forks source link

Ideal template #1

Open imh opened 10 years ago

imh commented 10 years ago

The original spec was

What would complete the awesomeness would be if there was also maybe a table of values for "map (\x -> (x*k, x+k)) [1..20]" or something.

you da best.

ghorn commented 10 years ago

the bullet points aren't too hard, what do you mean by the table of values for the 'map ...'?

imh commented 10 years ago

i imagined

---------------------------------------------------
| k input            |                                   |
| tan/sin switch |                                    |
|--------------------|                                    |
| k*1   |  k + 1   |     PLOTTY THINGS   |
| k*2   |  k + 2   |                                    |
| k*3   |  k + 3   |                                    |
| k*4   |  k + 4   |                                    |
---------------------------------------------------
imh commented 10 years ago

since you're offering, I'd appreciate the previous template to study and learn from, as well as these two, in order of increasing complexity, so i can learn from them without having to understand it all at once:

Definitions

let f 0 = 1 f i = (f $ i - 1) * k g i = if (mod i 12 == 0) then (f i) else (g $ i - 1) h 0 = 20 h i = 20 + (g $ i - 1) * j a i = (f i) * jp + (h i)

let: jp = j + q j = jp - q

GUI

Input boxes for jp, j, and q, where

a table for i, f, g, h, and a for i in [1..30]

a plot of either tan or sin of either f, g, h, or a, with a button setting the tan/sin choice, and a button setting the f/g/h/a choice.

Then again with

Then the same kind of thing, but with a different plot and some different types:

Definitions

Let f, g, h, and a be types where we have:

e (f 0) = 1 e (f i) = (e $ f $ i - 1) * k e (g i) = if (mod i 12 == 0) then (e $ f i) else (e $ g $ i - 1) e (h 0) = 20 e (h i) = 20 + (e $ g $ i - 1) * j e (a i) = (e $ f i) * jp + (e $ h i)

and

v (whatever 0) = 1 v (whatever i) = sqrt $ 1 + (v $ whatever $ i - 1)**2

and

d (whatever i) x = exp (- (x - (e $ whatever i))**2)

where 'whatever' is f, g, h, or a.

I doubt that this is the way the types would work here, but I hope it gets the point across of what I'm trying to achieve. I just want the recursion to compute some object that is more than what's displayed, and be able to be displayed as a value or a function.

GUI

This time instead of the plots above, it will plot (d $ whatever i) for whichever of the elements of the table is clicked. That element will be bold or colorful or something.

for example, if you have | 0 | f 0 | g 0 | h 0 | a 0 | | 1 | f 1 | g 1 | h 1 | a 1 | and click on g 1's box, that box's contents will become bold, and the plot will become a gaussian centered there.