Re: [pure-lang-users] case
Status: Beta
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2008-08-28 00:36:11
|
Eddie Rucker wrote: > (do (\i -> do (\j -> set m i j (type ((ys!i)!j))) (0..c-1)) (0..r-1) That kind of abomination will hopefully soon become much easier. With the help of macros it should be easy to write an optimization rule for the void combinator so that void [set m i j; i = ...; j = ...] will just translate to a nested do automagically. BTW, using 'set' for the setter is a bad idea, that's already used in set.pure. > case type of > int = gsl_matrix_int_alloc r c, gsl_matrix_int_set; > double = gsl_matrix_alloc r c, gsl_matrix_set; > end; > > but it seems that case uses (==) instead of (===). No it doesn't. Sorry, it's too late again, so I won't rehash the manual here. The explanations of 'head = function' and 'nullary' symbols in the manual should help. (You can't match against an ordinary function symbol, it must be a constant. So you might want to define your own symbolic constants for the different types. Or you could just pass a "witness" of the type and then match against _::int etc.) Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |