pure-lang-users Mailing List for Pure (Page 17)
Status: Beta
Brought to you by:
agraef
You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
(31) |
May
(422) |
Jun
(241) |
Jul
(268) |
Aug
(281) |
Sep
(109) |
Oct
(1) |
Nov
|
Dec
|
---|
From: Eddie R. <er...@bm...> - 2008-07-25 19:33:45
|
Sorry for sending this twice. I thought it failed to send the first time. e.r. |
From: Eddie R. <er...@bm...> - 2008-07-25 19:32:33
|
Hi guys! In Q we could write: (X+A)*(X+B) = X^2+(A+B)*X+(A*B); as an equation and Q would happily reduce (X+2)*(X+4); to X^2+6*X+8 which was nice. But in Pure, since we cannot repeat a variable on the left hand side, we cannot do any of these nice equations: X*Y+X*Z = X*(Y+Z); X/X = 1 if X != 0; X+N*X = (N+1)*X; etc... Albert, I know you made an === operator but how are we suppose to use it to handle this sort of stuff? Ok. I've figured I need to do stuff like (a*b)+(c*d) = (a+c)*b if b === d; a*b=a^2 if a===b; (a+b)*(c+d) = a*c+a*d+b*c+b*d; a*b = b*a if numberp b; Then > (x+4)*(x+3) x^2+3*x+4*x+12 Why doesn't the rule '(a*b)+(c*d) = (a+c)*b if b === d;' reduce it further to x^2+7x+12 since > 3*x+4*x reduces to 7*x e.r. |
From: Eddie R. <er...@bm...> - 2008-07-25 19:31:44
|
Hi guys! In Q we could write: (X+A)*(X+B) = X^2+(A+B)*X+(A*B); as an equation and Q would happily reduce (X+2)*(X+4); to X^2+6*X+8 which was nice. But in Pure, since we cannot repeat a variable on the left hand side, we cannot do any of these nice equations: X*Y+X*Z = X*(Y+Z); X/X = 1 if X != 0; X+N*X = (N+1)*X; etc... Albert, I know you made an === operator but how are we suppose to use it to handle this sort of stuff? Ok. I've figured I need to do stuff like (a*b)+(c*d) = (a+c)*b if b === d; a*b=a^2 if a===b; (a+b)*(c+d) = a*c+a*d+b*c+b*d; a*b = b*a if numberp b; Then > (x+4)*(x+3) x^2+3*x+4*x+12 Why doesn't the rule '(a*b)+(c*d) = (a+c)*b if b === d;' reduce it further to x^2+7x+12 since > 3*x+4*x reduces to 7*x e.r. |
From: Libor S. <li...@gm...> - 2008-07-24 12:12:29
|
I am on a short holiday, will be back on Sunday, looking forward to getting back to Pure then. Libor |
From: Eddie R. <er...@bm...> - 2008-07-22 22:58:18
|
On Tue 22/07/08 5:45 PM , Albert Graef Dr....@t-... sent: > Eddie Rucker wrote: > > What's up with svn? Usually, I can go there using > firefox and pull up> libraries, runtime.hh, etc. for documentation purposes. > For the last> week (except a few short period times) I haven't been > able to browse> svn. > > Yes, ViewVC seems to be disabled for now, apparently some overhaul of > the SVN infrastructure is in progress. More info on the (new) site > status page at http://sourceforge.net/sitestatus. We can also > joyfully look forward to a pending migration and major update of the shell/web > services which probably means that this will soon be broken, too. :( > > Albert > Major bummer :-( |
From: Albert G. <Dr....@t-...> - 2008-07-22 22:45:13
|
Eddie Rucker wrote: > What's up with svn? Usually, I can go there using firefox and pull up > libraries, runtime.hh, etc. for documentation purposes. For the last > week (except a few short period times) I haven't been able to browse > svn. Yes, ViewVC seems to be disabled for now, apparently some overhaul of the SVN infrastructure is in progress. More info on the (new) site status page at http://sourceforge.net/sitestatus. We can also joyfully look forward to a pending migration and major update of the shell/web services which probably means that this will soon be broken, too. :( 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 |
From: Eddie R. <er...@bm...> - 2008-07-22 17:59:47
|
Hi all! What's up with svn? Usually, I can go there using firefox and pull up libraries, runtime.hh, etc. for documentation purposes. For the last week (except a few short period times) I haven't been able to browse svn. e.r. |
From: Eddie R. <er...@bm...> - 2008-07-21 21:22:34
|
On Mon, 2008-07-21 at 23:20 +0200, Jiri Spitz wrote: > Eddie Rucker wrote: > > Shouldn't > > > list (1,2,3); > > > > > > > return [1,2,3]? > > > > On my machine it doesn't return anything. > > > List is an interpreter command. You have to prefix the the line with a > space to distinguish the function list from the command list " list > (1,2,3);". > > Jiri Yep, that did the trick. Thanks! e.r. |
From: Jiri S. <jir...@bl...> - 2008-07-21 21:20:19
|
Eddie Rucker wrote: > Shouldn't > > list (1,2,3); > > > > return [1,2,3]? > > On my machine it doesn't return anything. > List is an interpreter command. You have to prefix the the line with a space to distinguish the function list from the command list " list (1,2,3);". Jiri |
From: Eddie R. <er...@bm...> - 2008-07-21 21:09:19
|
Hi Albert, Shouldn't > list (1,2,3); > return [1,2,3]? On my machine it doesn't return anything. e.r. |
From: John C. <co...@cc...> - 2008-07-21 17:59:08
|
The W3C has issued a new draft of the unified entity definitions, updating the names phi, lang, rang, OverParenthesis, UnderParenthesis, OverBrace, UnderBrace, lbbrk, and rbbrk. The new entity definition file is at http://www.w3.org/2003/entities/2007/w3centities-f.ent . Q and Pure should be updated accordingly; TagSoup will be. -- John Cowan <co...@cc...> http://ccil.org/~cowan Micropayment advocates mistakenly believe that efficient allocation of resources is the purpose of markets. Efficiency is a byproduct of market systems, not their goal. The reasons markets work are not because users have embraced efficiency but because markets are the best place to allow users to maximize their preferences, and very often their preferences are not for conservation of cheap resources. --Clay Shirkey |
From: Eddie R. <er...@bm...> - 2008-07-21 14:53:10
|
On Mon, 2008-07-21 at 16:36 +0200, Jiří Spitz wrote: > Eddie Rucker wrote: > > When I tried to test a script I had written using notepad on my Linux > > box I got the following errors. > > > > erucker@erucker:~/Desktop$ pure -i test.pure > > 'est.pure:4.8: invalid character ' > > test.pure:4.8: syntax error, unexpected invalid character > > 'est.pure:5.14: invalid character ' > > test.pure:6.28: syntax error, unexpected ']', expecting '=' or '|' > > test.pure:6.62-64: syntax error, unexpected ']', expecting '=' or '|' > > 'est.pure:6.66: invalid character ' > > ... > > > This is problem of different file formats on Linux and Windows. Windows' > text files have lines delimited by CR+LF characters wheras Linux' ones > only by LF. Files created under Windows exhibit the described behaviour > under Linux. Most programers' text editors (not Notepad) allow change > the file format. I'm not too familiar with Windoze but I knew about the \r\n sequences. I had to write the script on someone else's machine (who doesn't want another text editor) and I had to test it on my Linux box. It just seems strange that e.r. |
From: Jiří S. <jir...@bl...> - 2008-07-21 14:36:44
|
Eddie Rucker wrote: > When I tried to test a script I had written using notepad on my Linux > box I got the following errors. > > erucker@erucker:~/Desktop$ pure -i test.pure > 'est.pure:4.8: invalid character ' > test.pure:4.8: syntax error, unexpected invalid character > 'est.pure:5.14: invalid character ' > test.pure:6.28: syntax error, unexpected ']', expecting '=' or '|' > test.pure:6.62-64: syntax error, unexpected ']', expecting '=' or '|' > 'est.pure:6.66: invalid character ' > ... > This is problem of different file formats on Linux and Windows. Windows' text files have lines delimited by CR+LF characters wheras Linux' ones only by LF. Files created under Windows exhibit the described behaviour under Linux. Most programers' text editors (not Notepad) allow change the file format. Jiri |
From: Eddie R. <er...@bm...> - 2008-07-21 14:23:51
|
On Mon, 2008-07-21 at 09:20 -0500, Eddie Rucker wrote: > Hi Albert, > qsort p [] = []; > qsort p (x:xs) > = sort p [l; l = xs; l < x] + (x : sort p [r; r = xs; r >= x]) > with > x < y = p x y; > x >= y = not p x y; > end; BTW, I hope you don't mind that I ripped off your qsort ;-) e.r. |
From: Eddie R. <er...@bm...> - 2008-07-21 14:20:00
|
Hi Albert, When I tried to test a script I had written using notepad on my Linux box I got the following errors. erucker@erucker:~/Desktop$ pure -i test.pure 'est.pure:4.8: invalid character ' test.pure:4.8: syntax error, unexpected invalid character 'est.pure:5.14: invalid character ' test.pure:6.28: syntax error, unexpected ']', expecting '=' or '|' test.pure:6.62-64: syntax error, unexpected ']', expecting '=' or '|' 'est.pure:6.66: invalid character ' ... Notice that it says 'est.pure...' instead of 'Test.pure...' Anyway, the first few lines of the source were: qsort p [] = []; qsort p (x:xs) = sort p [l; l = xs; l < x] + (x : sort p [r; r = xs; r >= x]) with x < y = p x y; x >= y = not p x y; end; When, I opened the file from emacs, I noticed all of the ^M ('\r's) at the end of each line. After removing them, the script runs fine. To say the least, it was a hard bug to find because the script looked just fine from Kate. e.r. |
From: Albert G. <Dr....@t-...> - 2008-07-21 12:55:47
|
Eddie Rucker wrote: > Personally, I prefer 'when end' to 'when begin end.' Me too, obviously. :) Pascal's begin ... end goes back to Algol, but Wirth himself later realized that properly bracketed statements are better and more economic, so that's what Modula and Oberon have. > However, 'when {}' isn't bad but I figure you'll use '{}' for streams. Either that, or structs, or generalized list comprehensions. In any case it seems like a good idea to keep {} unused for now. 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 |
From: Eddie R. <er...@bm...> - 2008-07-21 12:35:57
|
On Mon, 2008-07-21 at 05:33 +0200, Albert Graef wrote: > Eddie Rucker wrote: > > What do you think about the following addition to syntax? If there is exactly one statement > > inside of a 'with' or when 'block,' we could leave off the 'end.' > > Yeah, that would be convenient, but unfortunately it's not possible, > since the grammar would become ambiguous (or non-LALR at least). > > Albert > Ok, I forgot Pascal used 'begin end' pairs to define a block. Personally, I prefer 'when end' to 'when begin end.' However, 'when {}' isn't bad but I figure you'll use '{}' for streams. e.r. |
From: Eddie R. <er...@bm...> - 2008-07-21 12:31:41
|
On Mon, 2008-07-21 at 05:23 +0200, Albert Graef wrote: > Eddie Rucker wrote: > >> [v; v = map (\rw -> rw!2 + rw!4) ranked; v > 0]; > > > > Thanks Jiri, that works, but it is still not in the list comprehension spirit (without filter, map, fold, and zip) > > I was looking for. > > How about: > > [v; v = [rw!2 + rw!4; rw = ranked]; v > 0]; > > (Haven't checked this, though.) > That's the ticket! Jiri's map as a list comprehension and I should have seen that. Not making any excuses, but this sinus headache for the last few days has got me all messed up. e.r. |
From: Albert G. <Dr....@t-...> - 2008-07-21 03:33:05
|
Eddie Rucker wrote: > What do you think about the following addition to syntax? If there is exactly one statement > inside of a 'with' or when 'block,' we could leave off the 'end.' Yeah, that would be convenient, but unfortunately it's not possible, since the grammar would become ambiguous (or non-LALR at least). 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 |
From: Albert G. <Dr....@t-...> - 2008-07-21 03:28:52
|
Ryan Schmidt wrote: > Ok, pure r438 works with llvm-devel at 53722 so that's fine. The pure- > devel port is updated! Thanks. So it seems that there are still some OSX bugs in LLVM 2.3 which are fixed in the latest LLVM from svn? I should probably mention that in the INSTALL file somewhere. 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 |
From: Albert G. <Dr....@t-...> - 2008-07-21 03:23:44
|
Eddie Rucker wrote: >> [v; v = map (\rw -> rw!2 + rw!4) ranked; v > 0]; > > Thanks Jiri, that works, but it is still not in the list comprehension spirit (without filter, map, fold, and zip) > I was looking for. How about: [v; v = [rw!2 + rw!4; rw = ranked]; v > 0]; (Haven't checked this, though.) -- 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 |
From: Eddie R. <er...@bm...> - 2008-07-20 21:52:24
|
On Sun 20/07/08 3:40 PM , Jiri Spitz jir...@bl... sent: > Eddie Rucker wrote: > > Is there a way to create a new value from separate > values inside a list comprehension?> > > ranked is a list of lists. I want to addelement 2 and 4 > and record the result if > it is positive. Yes, it is trival to do without a list > comprehension but I want> to do it with one. > > > > [v; v > 0; v = rw!2 + rw!4; rw = ranked]; > > > > I know this doesn't work; > > > > [v; rw = ranked; v > 0] when v = rw!2 + rw!4 > end;> > E. g. this way: > > [v; v = map (\rw -> rw!2 + rw!4) ranked; v > 0]; Thanks Jiri, that works, but it is still not in the list comprehension spirit (without filter, map, fold, and zip) I was looking for. If not using list comprehensions, I think a filter_map and filter_fold like the filter-map that srfi 1 offers would be efficient for things like this. I'll add filter_map and filter_fold to my TODO list utility library. e.r. |
From: Jiri S. <jir...@bl...> - 2008-07-20 20:40:26
|
Eddie Rucker wrote: > Is there a way to create a new value from separate values inside a list comprehension? > > ranked is a list of lists. I want to addelement 2 and 4 and record the result if > it is positive. Yes, it is trival to do without a list comprehension but I want > to do it with one. > > [v; v > 0; v = rw!2 + rw!4; rw = ranked]; > > I know this doesn't work; > > [v; rw = ranked; v > 0] when v = rw!2 + rw!4 end; > E. g. this way: [v; v = map (\rw -> rw!2 + rw!4) ranked; v > 0]; Jiri |
From: Eddie R. <er...@bm...> - 2008-07-20 18:35:13
|
Hi Albert, What do you think about the following addition to syntax? If there is exactly one statement inside of a 'with' or when 'block,' we could leave off the 'end.' Instead of with rule1 end; we could have with rule1; e.r. |
From: Eddie R. <er...@bm...> - 2008-07-20 18:25:17
|
Is there a way to create a new value from separate values inside a list comprehension? ranked is a list of lists. I want to addelement 2 and 4 and record the result if it is positive. Yes, it is trival to do without a list comprehension but I want to do it with one. [v; v > 0; v = rw!2 + rw!4; rw = ranked]; I know this doesn't work; [v; rw = ranked; v > 0] when v = rw!2 + rw!4 end; e.r. |