25 Jun 08:16 2013

## writing a function to make a correspondance between type-level integers and value-level integers

```
Well, I guess you might be interested in geometric algebra then
http://dl.acm.org/citation.cfm?id=1173728
because Geometric Algebra is a quite more principled way of doing
component-free calculations. See also the web page of the author
http://staff.science.uva.nl/~fontijne/

Geigen seems like a nice DSL that could well be embedded in Haskell.

Anyway, the reason I pointed out Vectro is that it answers your
question about reifying and reflecting type-level integers (by means
of a type class).
```
25 Jun 23:21 2013

### Re: writing a function to make a correspondance between type-level integers and value-level integers

```Thanks Oleg,

I have discovered geometric algebra some months ago. There is a textbook on
the topic:

http://eu.wiley.com/WileyCDA/WileyTitle/productCd-0470941634.html

It seems very interesting, but I have not currently the time to make a
detailed comparison with vector/tensor algebra. Moreover I have not your
level of knowledge in Haskell/Standard ML and type theory, so I have already
a lot of work. However, for sure this is something I will do in the few next
years, because I think that notations are very important in physics and
mathematics: it is of huge interest to have a condensed and easy to remember
notation; still better if it is easily extended to higher dimensions/orders
(unfortunately, generally these notations are not taught at university).

Regards,

TP

oleg <at> okmij.org wrote:

> Well, I guess you might be interested in geometric algebra then
>         http://dl.acm.org/citation.cfm?id=1173728
> because Geometric Algebra is a quite more principled way of doing
> component-free calculations. See also the web page of the author
>         http://staff.science.uva.nl/~fontijne/
>
> Geigen seems like a nice DSL that could well be embedded in Haskell.
>
```

6 May 18:12 2003

### RE: writing a function to build a list of ints from user input

```
> On Tue, May 06, 2003 at 05:02:56AM -0500, Galen Menzel wrote:
> >
> > makeList :: IO [Int]
> > makeList = do s <- getLine
> > 	      case read s of
> > 		0 -> return []
> > 		x -> do xs <- makeList
> > 			return (x:xs)
> >
> > I changed the if to a case so that (read s) doesn't get
> called twice.
>
> Does the compiler not optimize away identical calls? Or is it
> not allowed to, for some reason?

Yes, GHC will common up the repeated expression when -O is turned on.

> On the other hand, if I write a function like:
>
> long_list = [1..100000] ++ [1..100000] ++ [1..100000] ++ [1..100000]
>
> And then run a
>
>  putStr \$ unlines \$ map show long_list
>
> I would expect this to take very little memory, which would
> mean that the
> [1..100000] would need to be calculated four separate times
> rather than
```