pure-lang-users Mailing List for Pure (Page 13)
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-08-18 14:56:41
|
Something bad is happening here for the complex numbers: > sqrt (1+:2); 2.23606797749979*cos (t/2)+:2.23606797749979*sin (t/2) the angle t is missing. Another nice way of doing this is: sqrt (x+:y) = sqrt (0.5*(r+a)) +: sqrt (0.5*(r-a)) when r = sqrt x*x+y*y; end; e.r. |
From: Eddie R. <er...@bm...> - 2008-08-18 13:46:56
|
On Mon, 2008-08-18 at 08:43 -0500, Eddie Rucker wrote: > IMHO, the following rules should be added for pow: > > pow n::int (x%y) | > pow n::bigint (x%y) | > pow n::double (x%y) = pow n (x/y); > > So that > > pow 16 (1%2); > 4.0 > > instead of the current > > pow 16 (1%2); > pow 16 (1L%2L) > Forgot to mention the reason: > 15^(-1%2); 3.87298334620742 > pow 15 (1%2); pow 15 (1L%2L) should be consistent. e.r. |
From: Eddie R. <er...@bm...> - 2008-08-18 13:43:14
|
IMHO, the following rules should be added for pow: pow n::int (x%y) | pow n::bigint (x%y) | pow n::double (x%y) = pow n (x/y); So that > pow 16 (1%2); 4.0 instead of the current > pow 16 (1%2); pow 16 (1L%2L) e.r. On Mon, 2008-08-18 at 08:29 -0500, Eddie Rucker wrote: > Should the rule > > a%b = a if b == 1 || b == 1L; > > be added to math.pure or should this be defined by the user? > > e.r. > > On Mon, 2008-08-18 at 08:02 -0500, Eddie Rucker wrote: > > On Mon, 2008-08-18 at 14:08 +0200, Albert Graef wrote: > > > Albert Graef wrote: > > > > - The discussion I had with Libor about how to implement a sequencing > > > > operator ("first x, then y") also kept me thinking, because the solution > > > > I proposed there is not tail-recursive. To do this in a proper way, we'd > > > > need a built-in sequencing operator (special form). While it's not > > > > strictly needed, it's much more convenient than having to write 'y when > > > > _ = x end' all the time. > > > > > > This is now implemented as well. ($$ operator) > > > > > > I'm basically through with my 0.5 TODO list now (Windows port > > > notwithstanding; I can hopefully take a look at that later today). So if > > > anyone is still listening, it would be nice if you could take the latest > > > svn for a test drive. ;-) > > > > > > I also vaguely recall that someone volunteered to write a little test > > > module for math.pure, or did I just dream that up? :) > > > > Was that me? I'll see what I can do ASAP. > > > > e.r. > > > > > > ------------------------------------------------------------------------- > > 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 > > > ------------------------------------------------------------------------- > 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: Eddie R. <er...@bm...> - 2008-08-18 13:29:32
|
Should the rule a%b = a if b == 1 || b == 1L; be added to math.pure or should this be defined by the user? e.r. On Mon, 2008-08-18 at 08:02 -0500, Eddie Rucker wrote: > On Mon, 2008-08-18 at 14:08 +0200, Albert Graef wrote: > > Albert Graef wrote: > > > - The discussion I had with Libor about how to implement a sequencing > > > operator ("first x, then y") also kept me thinking, because the solution > > > I proposed there is not tail-recursive. To do this in a proper way, we'd > > > need a built-in sequencing operator (special form). While it's not > > > strictly needed, it's much more convenient than having to write 'y when > > > _ = x end' all the time. > > > > This is now implemented as well. ($$ operator) > > > > I'm basically through with my 0.5 TODO list now (Windows port > > notwithstanding; I can hopefully take a look at that later today). So if > > anyone is still listening, it would be nice if you could take the latest > > svn for a test drive. ;-) > > > > I also vaguely recall that someone volunteered to write a little test > > module for math.pure, or did I just dream that up? :) > > Was that me? I'll see what I can do ASAP. > > e.r. > > > ------------------------------------------------------------------------- > 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: Eddie R. <er...@bm...> - 2008-08-18 13:02:31
|
On Mon, 2008-08-18 at 14:08 +0200, Albert Graef wrote: > Albert Graef wrote: > > - The discussion I had with Libor about how to implement a sequencing > > operator ("first x, then y") also kept me thinking, because the solution > > I proposed there is not tail-recursive. To do this in a proper way, we'd > > need a built-in sequencing operator (special form). While it's not > > strictly needed, it's much more convenient than having to write 'y when > > _ = x end' all the time. > > This is now implemented as well. ($$ operator) > > I'm basically through with my 0.5 TODO list now (Windows port > notwithstanding; I can hopefully take a look at that later today). So if > anyone is still listening, it would be nice if you could take the latest > svn for a test drive. ;-) > > I also vaguely recall that someone volunteered to write a little test > module for math.pure, or did I just dream that up? :) Was that me? I'll see what I can do ASAP. e.r. |
From: Albert G. <Dr....@t-...> - 2008-08-18 12:08:08
|
Albert Graef wrote: > - The discussion I had with Libor about how to implement a sequencing > operator ("first x, then y") also kept me thinking, because the solution > I proposed there is not tail-recursive. To do this in a proper way, we'd > need a built-in sequencing operator (special form). While it's not > strictly needed, it's much more convenient than having to write 'y when > _ = x end' all the time. This is now implemented as well. ($$ operator) I'm basically through with my 0.5 TODO list now (Windows port notwithstanding; I can hopefully take a look at that later today). So if anyone is still listening, it would be nice if you could take the latest svn for a test drive. ;-) I also vaguely recall that someone volunteered to write a little test module for math.pure, or did I just dream that up? :) 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-08-17 21:34:29
|
Albert Graef wrote: > Albert Graef wrote: >>> - search the directory of the script containing the using clause >>> >>> - failing that, search the cwd >>> >>> - failing that, search PURELIB > > Ok, this is implemented now. I also threw in some script name > canonicalization and symbolic link resolution, details can be found in > the ChangeLog and in the DECLARATIONS section of the manpage. I still wasn't satisfied with all this, so I gave it another thorough overhaul. The new search algorithm also puts to rest the non-portable workarounds which were necessary to load dynamic libraries in Pure scripts. I hope that this will do the job now. Here's the full blurb from the ChangeLog: The prelude is now *always* searched for in PURELIB only, to prevent code injection issues. Thus to use a custom prelude you'll have to set the PURELIB environment variable accordingly, or employ the '-n' option and explicitly specify the prelude on the command line. Scripts specified on the command line or with the 'run' command will *only* be searched for in the current directory. In addition to the PURELIB environment variable, new -I/-L command line options and PURE_INCLUDE/PURE_LIBRARY environment variables are now available to specify additional directories to search for source files and dynamic libraries specified using relative pathnames in 'using' clauses. For source scripts opened with a 'using' clause, the interpreter searches the following directories in the given order: - the directory of the script containing the 'using' clause (or the current working directory if the 'using' clause is read from standard input), - directories specified with -I, in the order in which they are specified on the command line, - directories specified in colon-separated format in the PURE_INCLUDE variable, in the order in which they are specified, - the PURELIB directory. Similarly, dynamic libraries are searched for in: - the directory of the script containing the 'using' clause (or the current working directory if the 'using' clause is read from standard input), - directories specified with -L, in the order in which they are specified on the command line, - directories specified in colon-separated format in the PURE_LIBRARY variable, in the order in which they are specified, - the PURELIB directory, - other platform-specific locations searched by the dynamic linker, such as system library directories and LD_LIBRARY_PATH on Linux. Note that in either case the current working directory is *not* searched by default (unless the 'using' clause is read from standard input), but of course you can force this by adding '.' to the corresponding search path. -- 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-08-17 13:03:56
|
> - First and foremost, I want to see whether I can massage the grammar so > that it becomes possible to write lists of tuples using the special case > syntax [(1,2),(3,4),...]. This is now implemented (r521). Probably the most important single cosmetic change in this release. :) -- 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-08-16 23:51:47
|
Albert Graef wrote: > Eddie Rucker wrote: >> What if we want to override the primitives.pure for some strange reason >> that I cannot think of yet? > > Well, it's a kludge, but of course you could just ship a custom prelude > with your application and write a wrapper script that sets up PURELIB > accordingly. I think that this is actually preferable, since it makes it > clear that your program operates in a nonstandard environment. I should have read the manpage first. ;-) Of course the simplest way to override the prelude and its dependent modules still is to just place prelude.pure et al into the current directory. This works because the prelude is searched first in the cwd, and with the new script search algorithm other modules used by the prelude then pick up the path from prelude.pure. 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-08-16 23:47:30
|
Albert Graef wrote: >> - search the directory of the script containing the using clause >> >> - failing that, search the cwd >> >> - failing that, search PURELIB > > Thinking about this some more, I realized that this is vunerable to code > injection. What if the user inadvertently puts a module named > 'primitives.pure' into the cwd? > > Therefore I think that PURELIB should actually be searched before the > cwd (much like #include <foo.h> in C). Note that if the 'using' script > is in the cwd, then the cwd will still be searched first anyway. Also, > this will only apply to 'using' clauses, not to scripts specified on the > command line or with 'run'. Ok, this is implemented now. I also threw in some script name canonicalization and symbolic link resolution, details can be found in the ChangeLog and in the DECLARATIONS section of the manpage. The new 'using' syntax is now implemented as well, so multiple script names in one clause have to be separated with commas 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: Albert G. <Dr....@t-...> - 2008-08-16 10:29:03
|
David Baird wrote: > It doesn't seem that anyone has yet taken up an effort to get Pure or > Q into the official Debian package lists. So, unless someone else has > a special interest, I was thinking of volunteering to be a package > maintainer and seek out a sponsor [1] to get the packages into Debian > (and hopefully propagate into Ubuntu too...?). That would be much appreciated! (You'd probably need to get the LLVM debs updated, too, IIRC they're quite old.) > I also might look into getting this into Gentoo Portage too. Alvaro Castro Castilla has already done a Gentoo ebuild of LLVM and Pure, see this thread here: http://sourceforge.net/mailarchive/message.php?msg_name=487DAE08.2070804%40t-online.de > The other major distro is Fedora, which I am not too keen on Fedora is RPM-based, so one could probably take Toni Graffy's comprehensive openSUSE packages (see the Q and Pure websites for pointers) and try to massage them so that they build on Fedora. However, there already are Q packages for Fedora by Gerard Milmeister, again see the Q website for pointers. Maybe one could convince Gerard to do packages for Pure as well. Anyone running Fedora here? > Would this effort be encouraged, Certainly! If you run into any problems, just post to the mailing list and we'll sort them out. Cheers, 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: David B. <dh...@gm...> - 2008-08-16 04:27:02
|
Hi, It doesn't seem that anyone has yet taken up an effort to get Pure or Q into the official Debian package lists. So, unless someone else has a special interest, I was thinking of volunteering to be a package maintainer and seek out a sponsor [1] to get the packages into Debian (and hopefully propagate into Ubuntu too...?). I also might look into getting this into Gentoo Portage too. The other major distro is Fedora, which I am not too keen on (Can't just untar a stage2 and go? Can't just run debootstrap? You mean I have to install from a CD?!?!? And why don't the scripts make any sense? :-P). This would probably be the most responsible thing I've done in my life, so I'm a little nervous about the commitment. But can it really be _that_ bad? Would this effort be encouraged, or is someone else already planning to tackle this? -David [1] http://people.debian.org/~mpalmer/debian-mentors_FAQ.html |
From: Albert G. <Dr....@t-...> - 2008-08-15 23:37:07
|
Eddie Rucker wrote: > when I highlight a sequence of numbers vertically from an openoffice > spreadsheet and middle click in the () I get Yeah, I get similar results, with both OOo calc and qcalc, so I believe it's a konsole/xterm issue. Well, I guess we need a port of qcalc asap, but first I need to get the base system right, then the SWIG interface, then port Qt/Q... 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-08-15 14:09:27
|
On Fri, 2008-08-15 at 15:52 +0200, Albert Graef wrote: > Eddie Rucker wrote: > >> 1 2 3 > > Hey Libor, that's cute! Tain't thought of that one. But, ... How do you > > get at the elements? > > That's easy: > > > f x = a [] x with a xs (x@_ y) = a (y:xs) x; a xs x = x:xs end; > > f (1 2 3 4); > [1,2,3,4] > > > Would be nice if we could have something like [1 2 3 4] > > That would wreak havoc on the Pure grammar. But the above hack should do > the trick as long as the first element can't be mistaken for a closure. Understood about the havoc on the pure grammar. I thought you had something very useful for me for a second. However, > f x = a [] x with a xs (x@_ y) = a (y:xs) x; a xs x = x:xs end; > let k = f (); when I highlight a sequence of numbers vertically from an openoffice spreadsheet and middle click in the () I get > let k = f ();34 > 56 > 78 > 34 > 56 > 12 And when I highlight a sequence of numbers horizontally from an openoffice spreadsheet and middle click in the () I get > let k = f();34122334 Note quite what I was looking for but don't worry about it and be happy ;-) e.r. |
From: Albert G. <Dr....@t-...> - 2008-08-15 13:51:30
|
Eddie Rucker wrote: >> 1 2 3 > Hey Libor, that's cute! Tain't thought of that one. But, ... How do you > get at the elements? That's easy: > f x = a [] x with a xs (x@_ y) = a (y:xs) x; a xs x = x:xs end; > f (1 2 3 4); [1,2,3,4] > Would be nice if we could have something like [1 2 3 4] That would wreak havoc on the Pure grammar. But the above hack should do the trick as long as the first element can't be mistaken for a closure. 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-08-15 13:39:09
|
On Fri, 2008-08-15 at 15:34 +0200, Albert Graef wrote: > Eddie Rucker wrote: > > I have this page http://www.noslang.com/ bookmarked for a very good > > reason. Typing in BALIKMFA gave no results so it's probably not taken. > > Thanks for that link, it's an invaluable resource in these modern times. ;-) > > > Did you look up AAAAA? > > No, but I could already guess that it was some "Anonymous XYZ" kind of > thing... > AAAAA = American Association Against Acronym Abuse e.r. |
From: Albert G. <Dr....@t-...> - 2008-08-15 13:33:40
|
Eddie Rucker wrote: > I have this page http://www.noslang.com/ bookmarked for a very good > reason. Typing in BALIKMFA gave no results so it's probably not taken. Thanks for that link, it's an invaluable resource in these modern times. ;-) > Did you look up AAAAA? No, but I could already guess that it was some "Anonymous XYZ" kind of thing... -- 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-08-15 13:28:40
|
Eddie Rucker wrote: > What if we want to override the primitives.pure for some strange reason > that I cannot think of yet? Well, it's a kludge, but of course you could just ship a custom prelude with your application and write a wrapper script that sets up PURELIB accordingly. I think that this is actually preferable, since it makes it clear that your program operates in a nonstandard environment. 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-08-15 13:10:50
|
Libor Spacek wrote: > Maybe it is just me but when using Pure, I am always worrying: 'is this a tuple or is it a list?' Ok, I see. But I think that like so many things it's just a matter of practice, getting to know the language. I agree that having an extra tuple type makes things more complex, but, as I tried to point out in a previous post, it also makes some stuff more readable or familiar. If you come from a language like Haskell or Erlang where you're working with tuples all them time, then you'd surely miss them if they weren't provided. Real Lisp men of course don't need all that sugar. ;-) But language design is always a compromise, and every PL is a new exercise to find a certain sweet spot between simplicity, power and convenience. If you leave away everything that's not strictly needed, then you'll end up with combinatorial calculus without any builtins, but who would want to program in such a language? Of course, Pure's tuples being flat is a ... hmm ... speciality that takes some time getting used to. But I wanted to have tuples in Pure for notational convenience, and this was a really cheap way to get them at the cost of just a single infix operator, requiring no builtins at all. So yes, they're an ideosyncrasy, but I dare say that they're also elegant in a way, IMNSHO. > To complicate things further, I can also in many situations use simply 1 2 3, e.g. >> let a = 1 2 3; You don't want to do that. If your first element happens to be a hungry closure then you're busted. :) Cheers, 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-08-15 13:03:47
|
On Fri, 2008-08-15 at 12:48 +0100, Libor Spacek wrote: > To complicate things further, I can also in many situations use simply 1 2 3, e.g. > >let a = 1 2 3; > >a; > 1 2 3 Hey Libor, that's cute! Tain't thought of that one. But, ... How do you get at the elements? Would be nice if we could have something like [1 2 3 4] (where the spaces are any white space) without the commas so I could copy and paste from the clipboard straight into the interpreter. That is one great thing about DrScheme: Start with at the prompt > (histogram '()) or whatever function you need. Highlight the data from a Word (Soffice) or Spreadsheet, or Web table, middle button click the stuff between the '() in DrScheme and (histogram '(10 32 34 56 ...)) Except they are 'tabs' or 'end of lines' instead of spaces hit the 'end' key and press 'enter' and watch the magic happen. It's an X thing. Cannot do that with Windoze. e.r. |
From: Eddie R. <er...@bm...> - 2008-08-15 12:44:59
|
On Fri, 2008-08-15 at 13:20 +0200, Albert Graef wrote: > Eddie Rucker wrote: > >> OMG BTW IANAL BALIKMFA !! ;-) > > > > "but act like I know my freeking algebra" > > LOL, I have to remember that one. But of course I actually meant "but at > least I know my fscking acronyms". If that's not taken yet, I'm going to > patent it... ;-) > > Albert > I have this page http://www.noslang.com/ bookmarked for a very good reason. Typing in BALIKMFA gave no results so it's probably not taken. Did you look up AAAAA? e.r. |
From: Eddie R. <er...@bm...> - 2008-08-15 12:39:26
|
On Fri, 2008-08-15 at 13:13 +0200, Albert Graef wrote: > Albert Graef wrote: > > - search the directory of the script containing the using clause > > > > - failing that, search the cwd > > > > - failing that, search PURELIB > > Thinking about this some more, I realized that this is vunerable to code > injection. What if the user inadvertently puts a module named > 'primitives.pure' into the cwd? What if we want to override the primitives.pure for some strange reason that I cannot think of yet? Maybe we should have some mechanism like using <foo.pure> so that we know it's the one in the standard library? > Therefore I think that PURELIB should actually be searched before the > cwd (much like #include <foo.h> in C). Note that if the 'using' script > is in the cwd, then the cwd will still be searched first anyway. Also, > this will only apply to 'using' clauses, not to scripts specified on the > command line or with 'run'. |
From: Eddie R. <er...@bm...> - 2008-08-15 12:34:01
|
On Fri, 2008-08-15 at 12:57 +0200, Albert Graef wrote: > Albert Graef wrote: > >> Just pretend that it's an int in the extern declaration. That should > >> just work (FLW), even if you pass it a bigint (which gives you the > >> necessary range to represent all unsigned int values). > > > > No, it doesn't right now. Only 'long' arguments allow a bigint parameter > > right now. But it's easy to extend this to the other C int types (char, > > short, int), I'm working on that. > > Ok, I've implemented this, so if you need to pass an unsigned int > constant which is too big to be represented as a positive Pure int then > you can just pass a bigint instead. This works with all C int types now. > (In fact, since int constants are converted to bigints automatically > when they fall outside the int range, even something like foo 0xffffffff > will do the right thing.) For unsigned return values, you can use the > appropriate uint et al routines, as discussed previously. > > I consider this fixed now. Cue the "Don't worry..." song again. ;-) Happy +1 ;-) e.r. |
From: Albert G. <Dr....@t-...> - 2008-08-15 11:57:52
|
Jeremy Voorhis wrote: > OMG $$++ That gives me a syntax error. ;-) But look at this marvel! > OMG = id; > OMG $ (Im,feeling,silly)!2 $ OMG ponies; silly ponies Ok, I take it that $$ is the consensus. > Regarding tuples, I've always thought of tuples as representing > structures with a fixed number of slots, and that this was a perfectly > valid thing to do. That's what they are, but Pure also allows you to piece them together and manipulate them in any way you see fit. Also, in Haskell et al tuples are a builtin data structure, whereas in Pure they are just an algebraic type like any other (and are in fact completely defined in the prelude). > My Pure abilities are still weak, so somebody help > me out – I assumed tagged tuples would be useful for representing > algebraic types in a dynamic language like Pure, since they are good > for matching on. That's what poor Erlang programmers have to do. In Pure all your data is in fact a term algebra, so any function symbol can act as a constructor and you don't need this kludge. E.g., nil and bin act as constructors in the following example: nullary nil; insert nil y = bin y nil nil; insert (bin x L R) y = bin x (insert L y) R if y<x; = bin x L (insert R y) otherwise; (That works without having to declare anything, except a nullary symbol like nil so that the compiler can distinguish it from a variable when it occurs on the lhs of an eqn.) 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: Libor S. <li...@gm...> - 2008-08-15 11:48:04
|
On Fri, 15 Aug 2008 02:16:40 +0100, Albert Graef <Dr....@t-...> wrote: > Libor Spacek wrote: >> I am not entirely convinced that the tuples are even worth having at all. >> For the minimal (flatness) distinction, they ship in a lot of confusion. > > Can you elaborate on that? The only complication I see is the borked > list-of-tuples syntax, and I'm about to fix that (hopefully!). > Both lists and tuples are devices for ordering and grouping some items. I do not see the problem with using a pair of brackets to make the grouping explicit, as in the list [1,2,3] instead of relying on the precendence of the associativity and using a tuple 1,2,3. I have learnt through painful experience not to rely on remembering the exact precedence of numerous associative operators, especially when I can add my own. Maybe it is just me but when using Pure, I am always worrying: 'is this a tuple or is it a list?' I need to worry about it because selectors and functions will typically work only on one but not on the other. To give a trivial example: head (1..3); // is OK head (1,2,3); // is not OK So, if I return 1,2,3 instead of [1,2,3], everything falls down round my ears. I guess you will say that I ought to know better and you will be right. To complicate things further, I can also in many situations use simply 1 2 3, e.g. >let a = 1 2 3; >a; 1 2 3 So there are three ways of ordering and grouping items which are nearly the same but not quite, which I, at least, find a little bewildering. L. |