pure-lang-users Mailing List for Pure (Page 2)
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-09-26 17:05:49
|
catmap for strings has a bug. > upcase s::string = s-32 if s!0 >= "a" && s!0 <= "z"; = s; > catmap upcase "ainsworth"; "A"+("I"+("N"+("S"+("W"+("O"+("R"+("T"+("H"+[])))))))) The inner most parenthesis should be ("H"+""). e.r. |
From: John L. <joh...@gm...> - 2008-09-26 14:46:11
|
I wasn't suggesting that it should be in Pure. I was just showing an example of a possible ? operator. Sorry for any confusion caused. On 26 Sep 2008, at 15:30, John Cowan wrote: > John Lunney scripsit: > >> Well, I was thinking of the ternary conditional operator! >> I don't like it, but it does exist... > > If you want C, you know where to find it. > > ?: is not even an operator, because of its non-function-like behavior. > Algol 60 (notoriously a great improvement on most of its successors) > distinguished between statements and expressions, and yet it managed > to have both if-then(-else) statements and if-then-else expressions. |
From: John C. <co...@cc...> - 2008-09-26 14:30:53
|
John Lunney scripsit: > Well, I was thinking of the ternary conditional operator! > I don't like it, but it does exist... If you want C, you know where to find it. ?: is not even an operator, because of its non-function-like behavior. Algol 60 (notoriously a great improvement on most of its successors) distinguished between statements and expressions, and yet it managed to have both if-then(-else) statements and if-then-else expressions. -- John Cowan co...@cc... http://www.ccil.org/~cowan C'est la` pourtant que se livre le sens du dire, de ce que, s'y conjuguant le nyania qui bruit des sexes en compagnie, il supplee a ce qu'entre eux, de rapport nyait pas. --Jacques Lacan, "L'Etourdit" |
From: John L. <joh...@gm...> - 2008-09-26 14:01:00
|
Well, I was thinking of the ternary conditional operator! I don't like it, but it does exist... On 26 Sep 2008, at 08:51, John Cowan wrote: > Albert Graef scripsit: > >> Comparing the benefits of the -? predicate syntax against user- >> defined >> operators, for me the latter far outweigh the former. > > I agree in general, but I don't know why would you want an operator > beginning with '?'. > > -- > John Cowan http://ccil.org/~cowan co...@cc... > We want more school houses and less jails; more books and less > arsenals; > more learning and less vice; more constant work and less crime; more > leisure and less greed; more justice and less revenge; in fact, > more of > the opportunities to cultivate our better natures. --Samuel Gompers > > ---------------------------------------------------------------------- > --- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win > great prizes > Grand prize is a trip for two to an Open Source event anywhere in > the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > pure-lang-users mailing list > pur...@li... > https://lists.sourceforge.net/lists/listinfo/pure-lang-users |
From: Albert G. <Dr....@t-...> - 2008-09-26 08:47:08
|
John Cowan wrote: > I agree in general, but I don't know why would you want an operator > beginning with '?'. You never know what creative uses programmers can find for these. :) One use I can imagine is as a kind of dereferencing (prefix or postfix) operator. E.g., here is how you can define yourself convenient abbreviations for the reference 'get' and 'put' functions: > postfix 9 ? ; > r::pointer? = get r if refp r; > let r = ref 99; > r?; 99 > infixr 0 := ; > r::pointer := x = put r x if refp r; > r := r?+1; 100 > r := r?+1; 101 A potential infix use would be as an abbreviation for if-then-else, e.g.: > infixr 0 ? ; > def x?y,z = if x then y else z; > foo x = x!=0 ? 1/abs x, 0; > show foo foo x = if x!=0 then 1/abs x else 0; > foo 99; foo 0; 0.0101010101010101 0 Turning ? into an identifier constituent in the way you recommended would pretty much preclude such perfectly legitimate uses. 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: John C. <co...@cc...> - 2008-09-26 07:51:47
|
Albert Graef scripsit: > Comparing the benefits of the -? predicate syntax against user-defined > operators, for me the latter far outweigh the former. I agree in general, but I don't know why would you want an operator beginning with '?'. -- John Cowan http://ccil.org/~cowan co...@cc... We want more school houses and less jails; more books and less arsenals; more learning and less vice; more constant work and less crime; more leisure and less greed; more justice and less revenge; in fact, more of the opportunities to cultivate our better natures. --Samuel Gompers |
From: Albert G. <Dr....@t-...> - 2008-09-25 22:05:55
|
Albert Graef wrote: > John Lunney wrote: >> If Albert doesn't like the trailing ?, then I think isMatrix is a >> pretty decent compromise! > > Albert doesn't like CamelCase either. ;-) Just to clarify: I do like the -?, it's pretty suggestive for predicates. I'm only concerned with keeping the lexical syntax clean. Which isn't an issue in Scheme because it can be far more liberal in what is allowed in identifiers. But it just doesn't work that way in languages with infix operator syntax, at least not if you also allow the programmer to define his own operator symbols. Comparing the benefits of the -? predicate syntax against user-defined operators, for me the latter far outweigh the former. 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-09-25 20:30:20
|
John Lunney wrote: > If Albert doesn't like the trailing ?, then I think isMatrix is a > pretty decent compromise! Albert doesn't like CamelCase either. ;-) Seriously, CamelCase has some advantages but it works really well only in case-insensitive languages. IMHO. But that may just be due to my Modula-2 trauma. :-P -- 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: John L. <joh...@gm...> - 2008-09-25 16:26:08
|
If Albert doesn't like the trailing ?, then I think isMatrix is a pretty decent compromise! John On 25 Sep 2008, at 17:20, John Cowan wrote: > Albert Graef scripsit: > >> Still I can't drag myself to like the idea that ? is an alphanumeric >> when ! and . aren't. ;-) > > Well, as I say, you can treat it as a restricted part of identifier > syntax: > > <identifier> :== <alpha> <alphanum>{0,} <question-mark>{0,1} > >> Any other ideas about a sane naming convention for type predicates >> that does not require changes in the lexical syntax? > > I think the Q "is" convention was actually pretty good, and it's only > one silly letter longer than the -p convention. > > (This alludes to an ancient commercial for Chesterfield cigarettes; > they came in standard and 101-mm (rather than 100-mm) sizes and were > sold using the slogan "Just a silly millimeter longer.") > > -- > John Cowan co...@cc... http://ccil.org/~cowan > If I have seen farther than others, it is because I am surrounded > by dwarves. > --Murray Gell-Mann |
From: John C. <co...@cc...> - 2008-09-25 16:20:12
|
Albert Graef scripsit: > Still I can't drag myself to like the idea that ? is an alphanumeric > when ! and . aren't. ;-) Well, as I say, you can treat it as a restricted part of identifier syntax: <identifier> :== <alpha> <alphanum>{0,} <question-mark>{0,1} > Any other ideas about a sane naming convention for type predicates > that does not require changes in the lexical syntax? I think the Q "is" convention was actually pretty good, and it's only one silly letter longer than the -p convention. (This alludes to an ancient commercial for Chesterfield cigarettes; they came in standard and 101-mm (rather than 100-mm) sizes and were sold using the slogan "Just a silly millimeter longer.") -- John Cowan co...@cc... http://ccil.org/~cowan If I have seen farther than others, it is because I am surrounded by dwarves. --Murray Gell-Mann |
From: me22 <me...@gm...> - 2008-09-25 15:38:53
|
On Thu, Sep 25, 2008 at 11:37, Albert Graef <Dr....@t-...> wrote: > > Still I can't drag myself to like the idea that ? is an alphanumeric > when ! and . aren't. ;-) Any other ideas about a sane naming convention > for type predicates that does not require changes in the lexical syntax? > What about emulating the character classification functions in ctype.h, which I presume you have? Those are, in a way, type predicates... |
From: Albert G. <Dr....@t-...> - 2008-09-25 15:34:01
|
John Lunney wrote: >> It certainly requires fewer explanations to people who aren't Lisp >> weenies. > > I would understand the former immediately and not the latter. Still I can't drag myself to like the idea that ? is an alphanumeric when ! and . aren't. ;-) Any other ideas about a sane naming convention for type predicates that does not require changes in the lexical syntax? 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-09-25 15:28:44
|
Jiri Spitz wrote: > s/*/-/ on the line 30 Fixed, thanks. :) -- 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: John L. <joh...@gm...> - 2008-09-25 13:28:51
|
On 25 Sep 2008, at 03:59, John Cowan wrote: > Albert Graef scripsit: >> I'm undecided on this. Is matrix? x really that much easier to >> read and >> understand than matrixp? > > It certainly requires fewer explanations to people who aren't Lisp > weenies. I would understand the former immediately and not the latter. John |
From: Eddie R. <er...@bm...> - 2008-09-25 12:49:47
|
On Thu, 2008-09-25 at 03:22 +0200, Albert Graef wrote: > No, I prefer it the other way round, e.g. > > rows x = map (row x) (0..n-1) when n,_ = dim x end; > > (Well, that's already in the prelude, but you get the idea...) > > And note that you can also write map (flip row 0) [m1, m2, m3] to get > what you want. The other way occurs more. OK. e.r. |
From: Jiri S. <jir...@bl...> - 2008-09-25 12:42:45
|
s/*/-/ on the line 30 Jiri |
From: John C. <co...@cc...> - 2008-09-25 02:59:55
|
Albert Graef scripsit: > I'm undecided on this. Is matrix? x really that much easier to read and > understand than matrixp? It certainly requires fewer explanations to people who aren't Lisp weenies. -- John Cowan co...@cc... I am a member of a civilization. --David Brin |
From: Albert G. <Dr....@t-...> - 2008-09-25 02:55:58
|
John Cowan wrote: > Everybody says that, but everybody goes ahead and allows "_" as a > letter anyhow, and even gives it a special meaning in certain contexts. That's true. But the underscore has been with us at least since Algol, so it isn't really perceived as punctuation by programmers. The use of ? in predicates isn't nearly as common, although I admit that it's suggestive. But ? is also about the only single ASCII character left that isn't either a delimiter symbol or predefined as an operator in Pure yet, which makes it kind of precious. I'm undecided on this. Is matrix? x really that much easier to read and understand than matrixp? 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-09-25 01:23:59
|
Albert Graef wrote: > P.S.: Pure's GSL matrix implementation is now complete in svn, I still > have to update the manual and fix a bug in system.pure tomorrow, then > I'm ready to release Pure 0.7. The manual is now updated, and I added the gauss.pure example illustrating some of the matrix functionality. There's still a few more minor glitches to fix in matrices.pure, 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: Albert G. <Dr....@t-...> - 2008-09-25 01:19:19
|
Eddie Rucker wrote: > row x::matrix i::int > > Is this backwards? Shouldn't it be 'row i::int x::matrix' so that > row can be used in map, filter, and friends. > > > map (row 0) [m1, m2, m3]; No, I prefer it the other way round, e.g. rows x = map (row x) (0..n-1) when n,_ = dim x end; (Well, that's already in the prelude, but you get the idea...) And note that you can also write map (flip row 0) [m1, m2, m3] to get what you want. 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-09-24 16:27:16
|
Hi Albert, row x::matrix i::int Is this backwards? Shouldn't it be 'row i::int x::matrix' so that row can be used in map, filter, and friends. > map (row 0) [m1, m2, m3]; e.r. |
From: John C. <co...@cc...> - 2008-09-24 14:41:57
|
Albert Graef scripsit: > Like most languages (except Lisp), Pure distinguishes between > alphanumeric characters forming identifiers and punctuation forming > delimiters and operator symbols. That's just the way it is. Everybody says that, but everybody goes ahead and allows "_" as a letter anyhow, and even gives it a special meaning in certain contexts. Some languages, like SQL and Cobol, go so far as to allow "-" as well. Ruby, in particular, allows "?" (predicate) and "!" (destructive) in final position in an identifier without taking on very much of the Lisp nature. Pure doesn't need "!", but it certainly could use "?". -- They do not preach John Cowan that their God will rouse them co...@cc... A little before the nuts work loose. http://www.ccil.org/~cowan They do not teach that His Pity allows them --Rudyard Kipling, to drop their job when they damn-well choose. "The Sons of Martha" |
From: Eddie R. <er...@bm...> - 2008-09-24 12:51:13
|
On Tue, 2008-09-23 at 21:27 -0400, John Cowan wrote: > Albert Graef scripsit: > > > It's null for Haskell compatibility. I think it's been called null in Q > > already for a long time, maybe even going back to Bird/Wadler ed. 1 > > which Q's notation was originally based on. And Lisp uses 'null', too. OK. I just have to quite making that mistake. > Scheme's Great Renaming did go with "null?" though. Kind of a pity, I think, > that you don't allow ? as an identifier character (at least at the end); > that way all predicates could uniformly use it. > And don't forget the ! at the end of all mutable procedures. That is one nice thing about using white space to separate parameters - you can use almost anything you want for naming of procedures like using -> in the middle of conversion procedures string->number, number->string, list->vector, etc. Trade offs, Trade offs, ... e.r. |
From: Albert G. <Dr....@t-...> - 2008-09-24 08:23:10
|
John Cowan wrote: > Scheme's Great Renaming did go with "null?" though. Yes, I know, but Haskell is more relevant there because the basic list operations in the Pure and libraries closely follow the Haskell prelude (or the original edition of the Bird/Wadler book). OTOH, I really only use the xyzp naming for type predicates, where typically xyz is already used for construction operations, so there must be a way to distinguish the two. > Kind of a pity, I think, > that you don't allow ? as an identifier character (at least at the end); > that way all predicates could uniformly use it. Like most languages (except Lisp), Pure distinguishes between alphanumeric characters forming identifiers and punctuation forming delimiters and operator symbols. That's just the way it is. It would be rather odd if '?' would be declared an alphanumeric symbol, not the right thing IMHO. 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: John C. <co...@cc...> - 2008-09-24 01:47:17
|
Albert Graef scripsit: > It's null for Haskell compatibility. I think it's been called null in Q > already for a long time, maybe even going back to Bird/Wadler ed. 1 > which Q's notation was originally based on. And Lisp uses 'null', too. Scheme's Great Renaming did go with "null?" though. Kind of a pity, I think, that you don't allow ? as an identifier character (at least at the end); that way all predicates could uniformly use it. -- Take two turkeys, one goose, four John Cowan cabbages, but no duck, and mix them http://www.ccil.org/~cowan together. After one taste, you'll duck co...@cc... soup the rest of your life. --Groucho |