q-lang-users Mailing List for Q - Equational Programming Language (Page 33)
Brought to you by:
agraef
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(3) |
Feb
(27) |
Mar
|
Apr
(4) |
May
(11) |
Jun
(5) |
Jul
(5) |
Aug
(6) |
Sep
(15) |
Oct
(28) |
Nov
(8) |
Dec
|
2005 |
Jan
(9) |
Feb
(5) |
Mar
(10) |
Apr
(43) |
May
(8) |
Jun
(31) |
Jul
(45) |
Aug
(17) |
Sep
(8) |
Oct
(30) |
Nov
(2) |
Dec
(6) |
2006 |
Jan
(4) |
Feb
(20) |
Mar
(1) |
Apr
|
May
(92) |
Jun
(179) |
Jul
(26) |
Aug
(65) |
Sep
(36) |
Oct
(38) |
Nov
(44) |
Dec
(68) |
2007 |
Jan
(11) |
Feb
(25) |
Mar
(37) |
Apr
(7) |
May
(83) |
Jun
(77) |
Jul
(44) |
Aug
(4) |
Sep
(28) |
Oct
(53) |
Nov
(12) |
Dec
(21) |
2008 |
Jan
(66) |
Feb
(45) |
Mar
(30) |
Apr
(50) |
May
(9) |
Jun
(18) |
Jul
(11) |
Aug
(6) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Albert G. <Dr....@t-...> - 2006-09-04 07:21:11
|
/me wrote: > I've tested these quite thoroughly, and so far everything seems to work > o.k. The only problem I noticed is that neither the GLUT teapot nor > NURBS work with the OpenGL software renderer, but that's apparently a > glitch in the Mesa version distributed with SuSE 10.1 (OpenGL demo > programs written in C exhibit the same behaviour). I just tested the examples again after installing the NVIDIA driver, and both the teapot and NURBS work just fine with hardware 3D acceleration. So it's indeed an issue with the software renderer. -- 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-...> - 2006-09-04 06:04:11
|
Hi, I just noticed that the ImageMagick version 6.2.6-x-Q16 used by the most recent build of the Qpad package doesn't seem to be available any more. Therefore I've uploaded a new build which now links against the most recent ImageMagick version, 6.2.9-3-Q16, which is also available from SourceForge, so it shouldn't just disappear from the net: http://prdownloads.sourceforge.net/imagemagick/ImageMagick-6.2.9-3-Q16-windows-dll.exe?download The new Qpad package is available here: http://prdownloads.sourceforge.net/q-lang/Qpad-7.4.msi?download If you already have a working Qpad installation, or if you don't use Q's magick module, there is no need to upgrade. You only need to install the new package if you want to use the magick module with the most recent Windows version of ImageMagick. 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: Albert G. <Dr....@t-...> - 2006-09-03 19:56:18
|
Hi, SuSE 10.1 packages are now available from the Download page, and the Faust packages have been updated to release 0.9.8. I also patched up the PortAudio packages (make sure you get v19-2) so that they work with Jack 0.100. I've tested these quite thoroughly, and so far everything seems to work o.k. The only problem I noticed is that neither the GLUT teapot nor NURBS work with the OpenGL software renderer, but that's apparently a glitch in the Mesa version distributed with SuSE 10.1 (OpenGL demo programs written in C exhibit the same behaviour). If anyone has an idea how to fix that please let me know. As usual, all new packages can be found on http://q-lang.sf.net/download.html 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: John C. <co...@cc...> - 2006-09-01 05:08:35
|
Albert Graef scripsit: > I'd say that's a bad idea, because it's inconsistent (at least from Q's > POV) and gives the Chicken programmer a very wrong idea about how these > operators behave in Q. Also, you'd have to handle user-defined > operators, too. Therefore I'd favour the idea of having a separate macro > to handle these cases. Well, I'll leave it out of the first release and concentrate on documenting what I've got. I should also have added that due to limitations in Chicken's foreign-function interface, only fixnums (in the range of 2^30) and floats can pass through. Larger integral values will be converted to floats before Chicken sees them, and will remain so when passed back to Q. When I can get support for bignums, adding rational and complex numbers should be no problem. -- We pledge allegiance to the penguin John Cowan and to the intellectual property regime co...@cc... for which he stands, one world under http://www.ccil.org/~cowan Linux, with free music and open source software for all. --Julian Dibbell on Brazil, edited |
From: Albert G. <Dr....@t-...> - 2006-08-31 08:08:27
|
John Cowan wrote: > I'm really, really close to releasing the beta version of my egg for > Chicken Scheme, which provides Chicken programmers with convenient access > to the Q interpreter. Hey, that's great! I'm currently downloading Chicken s.t. it's ready to go when you release your Q egg... > Nevertheless, this *is* surprising, and means that to represent "1+2+3" > as an S-expression one must write nested q:call lists. Yes, but that's to be expected. In difference to Lisp, Q's (+) is *not* variadic. If this is really too much hassle, you could maybe add something like a q:foldl/q:foldr macro which does the necessary expansion or translates to a q:call of Q's foldl1/foldr1. > I thought of > treating applications where the second element is an operator specially, I'd say that's a bad idea, because it's inconsistent (at least from Q's POV) and gives the Chicken programmer a very wrong idea about how these operators behave in Q. Also, you'd have to handle user-defined operators, too. Therefore I'd favour the idea of having a separate macro to handle these cases. 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: John C. <co...@cc...> - 2006-08-31 04:59:07
|
I'm really, really close to releasing the beta version of my egg for Chicken Scheme, which provides Chicken programmers with convenient access to the Q interpreter. There are only four points left: 1) Some code has not yet been fully tested. 2) I have to write some HTML documentation. 2) Improper tuples like "(1,2|3)" aren't yet being converted from S-expressions to Q binary representation. I expect they will be rare in Q expressions as opposed to rules: there is no S-expression representation of rules. 3) There is a conflict of expectations between Scheme and Q programmers around applications with multiple arguments. The Q application "f x" is written in S-expression form as (q:call f x); the "q:call" symbol marks it as an application rather than a list. (There are good reasons for not using a quote on the Scheme side.) Since Q is currying but Scheme is not, I allow "f x y" to be written as (q:call f x y) on the Scheme side, and that is treated as if it were (q:call (q:call f x) y). In particular, (q:call + 1 2) will properly reduce to 3. The difficulty arises when a binary operation is given more than two arguments. While testing, I tried normalizing (q:call + 1 2 3) and got back the surprising result (q:call 3 3). At first I thought there was a bug, but then I realized that the equivalent form was (q:call (q:call (q:call + 1) 2) 3), or in Q notation "(+) 1 2 3", which in fact means "((+) 1 2) 3" or simply "(1 + 2) 3", which indeed reduces to "3 3". Nevertheless, this *is* surprising, and means that to represent "1+2+3" as an S-expression one must write nested q:call lists. I thought of treating applications where the second element is an operator specially, but that would make it impossible to write the equivalent of "(1 + 2) 3" should one wish to do so. I'm very much open to suggestions on this one. Should I leave things alone? Should I introduce another q:xxx flag to mark calls of binary operators (required only if there are more than two arguments)? Or something else? If the last, what? -- But the next day there came no dawn, John Cowan and the Grey Company passed on into the co...@cc... darkness of the Storm of Mordor and were http://www.ccil.org/~cowan lost to mortal sight; but the Dead followed them. --"The Passing of the Grey Company" |
From: Albert G. <Dr....@t-...> - 2006-08-31 04:01:28
|
John Cowan wrote: > Builds and runs successfully on Cygwin. Nice, thanks for the report. Did anyone try the new Q Yacc/Lex yet? Q Yacc is still rather slow, so if anyone has an idea on how to further speed up the Q implementation of the LALR algorithm then please let me know. The generated parsers and scanners should be fast enough for practical purposes now, as I've reimplemented the internals of both yyparse and yylex in C. (They're still slower than pure C, as they call back into Q for the actions, but there's no way around that.) 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...> - 2006-08-30 21:56:12
|
Albert Graef scripsit: > I've just uploaded Q 7.4, which fixes a memory allocation bug in the > compiler. Also now available: Q Yacc/Lex 0.9 with more speed > improvements and bugfixes (a fairly complete Q grammar is now also > included in this package). Builds and runs successfully on Cygwin. -- Cash registers don't really add and subtract; John Cowan they only grind their gears. co...@cc... But then they don't really grind their gears, either; they only obey the laws of physics. --Unknown |
From: Albert G. <Dr....@t-...> - 2006-08-30 05:22:08
|
Hi, I've just uploaded Q 7.4, which fixes a memory allocation bug in the compiler. Also now available: Q Yacc/Lex 0.9 with more speed improvements and bugfixes (a fairly complete Q grammar is now also included in this package). The binary Q packages now also include the latest Q Yacc/Lex. As usual, all the good stuff is available from the Download page at http://q-lang.sf.net. 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: Albert G. <Dr....@t-...> - 2006-08-29 18:09:27
|
Burton Samograd wrote: > I know about SC, but for some reason I've avoided it since I found it > years ago, probably because I found the sytax very non-familiar at the > time. Yes, SC-Lang needs some time to get used to it, but it has such a great realtime sound+synth engine underneath. Good sound, and very low latency. That's what I mostly use, and it can be controlled quite conveniently from Q via OSC. I also started thinking about a Q API for the synth definitions. When that is finished, together with the sequencer interface I'm working on, then you will be able to just use Q as the SC language client instead of SC-Lang. 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: <q....@ae...> - 2006-08-28 05:41:26
|
<div align="left"><b><font size="5"> Want the degree but can’t find the time?</font></b><BR> <BR> WHAT A GREAT IDEA!<BR> We provide a concept that will allow anyone with sufficient work experience to obtain a fully verifiable University Degree.<BR> Bachelors, Masters or even a Doctorate.<BR> Think of it, within four to six weeks, you too could be a college graduate.<BR> Many people share the same frustration, they are all doing the work of the person that has the degree and the person that has the degree is getting all the money.<BR> Don’t you think that it is time you were paid fair compensation for the level of work you are already doing?<BR> This is your chance to finally make the right move and receive your due benefits.<BR> If you are like most people, you are more than qualified with your experience, but are lacking that prestigious piece of paper known as a diploma that is often th e passport to success.<BR> <b>CALL US TODAY AND GIVE YOUR WORK<BR> EXPERIENCE THE CHANCE TO EARN YOU<BR> THE HIGHER COMPENSATION YOU DESERVE!</b><BR> <font color="#FF0033" size="5">CALL NOW:</font><font color="#FF0033" size="7"><BR> <b>1-815-828-2222</b></font><BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> Ive left a letter telling your aunt and uncle not to worry -</div> |
From: MAILER-DAEMON <> - 2006-08-26 20:09:29
|
WW91ciBtZXNzYWdlIHRvOiBwendpZWJlbEBmbGludHNjaG9vbHMub3JnCndhcyBibG9ja2VkIGJ5 IG91ciBTcGFtIEZpcmV3YWxsLiBUaGUgZW1haWwgeW91IHNlbnQgd2l0aCB0aGUgZm9sbG93aW5n IHN1YmplY3QgaGFzIE5PVCBCRUVOIERFTElWRVJFRDoKClN1YmplY3Q6IFN0YXJ0IGVhcm5pbmcg dGhlIHNhbGFyeSB5b3UgZGVzZXJ2ZSBieSBvYnRhaW5pbmcgdGhlIHByb3BlciBjcmVkZW50aWFs cyEKCgoKKioqIFNjYW5uZWQgYnkgR2VuTkVUIEFWMTAgR2F0ZXdheSBPdXQgKioqCg== |
From: Shultz <boo...@st...> - 2006-08-26 12:20:24
|
<HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> </HEAD> <BODY> <DIV><img src="cid:65DHULV5F5JZZRD42TPM"></DIV> <DIV>Moreover, he may have sent it away by now - if ever there were such arolled it out sonorously -'do not trouble our heads with doctrine. Wesoldier going south on leave; and they all laughed. 'Will it travel toand the lama strode away, leaving Kim at the edge of the cloister.power was almost exactly that of his own pair, which he slid into theBuddhist stupas and viharas of the North Country and now, dug up andlama, who had mechanically followed Kim to the platform. He bowed his'Hear!' said the lama, shifting the rosary to his hand. 'Hear: for Ihouse?' he said in very fair Urdu. 'The Ajaib-Gher, the Wonder House!'all sorts of people to read them on the road. When, in Mahbub's ownwith her bundles, and it was on her that Kim kept his watchful eye.by the promise. 'Is he not quite mad?' said Kim, coming forward to theknew the talc was to win her approval. 'Alas!' said the cultivator'sthe bullying, red-bearded horsedealer whose caravans ploughed throughone attains freedom from the Wheel of Things,' the lama went on,arose. 'And whom didst thou worship within?' said Kim affably,</DIV> <DIV>crandall barbados amidst condescend</DIV> </BODY></HTML> |
From: Burton S. <kr...@gm...> - 2006-08-25 13:04:43
|
On 8/25/06, Albert Graef <Dr....@t-...> wrote: > Burton Samograd wrote: > > Music is one of the forms of art that I do that is getting the most > > attention lately > > The nickname kruhft rings a bell, but I don't recall whether I saw it in > a music context or maybe on LtU... I'll have a look, thanks for the pointer. I do post on LtU from time to time when I know enough about something to actually have something to say, but my schooling was in Computer Engineering and my work experience was video eames (a lot of 8 bit assembly on the Gameboy and lot low level C coding) so my vocabulary is a bit lacking when it comes to high level language topics. My study of computational linguistics has been an obsessive hobby for the past years (I like to say my own version of self directed grad school), but I think I've got a lot of the bases covered from what I've found, read, and studied over the years. > Regarding the audio stuff, one project that I'm still working on is an > improved interface to Faust and SuperCollider, which (1) handles all the > grunt work of loading Faust DSP plugins into SuperCollider and (2) > provides a high-level control interface similar to SuperCollider's own, > but written 100% in Q. I hope that I can still finish this before ICMC. > The current interfaces to Faust and SuperCollider in the Q-Faust and > Q-Synth packages are already quite usable, however, and they should let > you do pretty much any high-fidelity, low-latency, realtime audio > processing that you want (provided you have enough CPU power). I know about SC, but for some reason I've avoided it since I found it years ago, probably because I found the sytax very non-familiar at the time. I've used a number of other MIDI/DSP langugage system like KeyKit, PD, Chuck and Common Lisp Music for my works in the past and I read the docs for Faust and it looks pretty useful (plus there's builtin support for it in Audacity, which is a pretty nice audio editor that I recently added to my toolset), so I should probably take another look at SC and see if I can mentallly translate it bettter now that I have some more experience with alternate langages. -- burton samograd kr...@gm... kruhft.boldlygoingnowhere.org www.myspace.com/kruhft |
From: Rob H. <hub...@gm...> - 2006-08-25 12:12:25
|
Hello Fabian, As you seem to have noticed, the rule add [X|Xs] = X+add Xs; does not work for the list []. This is because [] does not match the pattern [X|Xs]. The pattern [X|Xs] is only matched by non-empty lists. Q has not been told what to do with "add []". Your modification fails to solve the problem for a similar reason. If you tell Q what to do with the following rule add [] = 0; then all will be well. Alternatively, if you're not happy with defining add on the empty list, you could do this: add [X] = X; add [X|Xs] = X+add Xs; Rob. On 25/08/06, Fabian Boucsein <kan...@we...> wrote: > hello, > > from the q manual i tried the following example: > > add [X|Xs] = X+add Xs; > > then i tried this to test the function: > > ==> add [1, 2, 3, 4] > 1+(2+(3+(4+add []))) > > what i want to know is, how can i change this function to get > back a result? i tried the following: > > add [X|Xs] = X+add Xs if Xs <> []; > > ==> add [1, 2, 3, 4] > 1+(2+(3+add [4])) > > which is still not the result i want. by the way i am using q 7.3 > maybe there is someone who can help me. > > greetings, > > fabian |
From: Albert G. <Dr....@t-...> - 2006-08-25 09:44:57
|
Burton Samograd wrote: > Music is one of the forms of art that I do that is getting the most > attention lately The nickname kruhft rings a bell, but I don't recall whether I saw it in a music context or maybe on LtU... I'll have a look, thanks for the pointer. Regarding the audio stuff, one project that I'm still working on is an improved interface to Faust and SuperCollider, which (1) handles all the grunt work of loading Faust DSP plugins into SuperCollider and (2) provides a high-level control interface similar to SuperCollider's own, but written 100% in Q. I hope that I can still finish this before ICMC. The current interfaces to Faust and SuperCollider in the Q-Faust and Q-Synth packages are already quite usable, however, and they should let you do pretty much any high-fidelity, low-latency, realtime audio processing that you want (provided you have enough CPU power). 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: Fabian B. <kan...@we...> - 2006-08-25 08:35:16
|
hello, from the q manual i tried the following example: add [X|Xs] = X+add Xs; then i tried this to test the function: ==> add [1, 2, 3, 4] 1+(2+(3+(4+add []))) what i want to know is, how can i change this function to get back a result? i tried the following: add [X|Xs] = X+add Xs if Xs <> []; ==> add [1, 2, 3, 4] 1+(2+(3+add [4])) which is still not the result i want. by the way i am using q 7.3 maybe there is someone who can help me. greetings, fabian |
From: Burton S. <kr...@gm...> - 2006-08-24 14:25:29
|
On 8/24/06, Albert Graef <Dr....@t-...> wrote: > Burton Samograd wrote: > > Thanks for the very informative response to my newbie problems :) > > No problem. In fact those newbie questions are valuable input for the > book about Q that I'm writing. I really have to add a "common pitfalls" > chapter to the book where I describe the usual suspects and how to deal > with them, and it's nice to have a ml archive which I can harvest for > that. :) So keep the newbie questions coming. Ok then, I shall ask without worry :) > > 3 shows this week, work and remix contests > > Are you a musician? Q has quite a bit of stuff to offer there. Together > with two colleagues, I'll be giving a talk on some of these interfaces > at ICMC 2006 in New Orleans. Music is one of the forms of art that I do that is getting the most attention lately, although I also do visual art, writing, and whatever else to keep myself busy. The easiest way to hear my music is through MySpace (see below in my signature), which I update pretty regularly with a rotation of songs, and if you google me (kruhft or burton samograd) you can find more of my music scattered about the 'net, and if you don't have time for that, I could just send you some links off list where you can download it from me since you're helping me out with learning Q :) One of the reasons I'm learning Q is because of the work you put in integrating the audio/image libraries that are included. I've worked with many different types of audio programing sytems, and they are all very capable, but I'm very much into 'interactive' and exploratory programming and most styems really lack any sort of suitable shell interface, which Q very capable provides and in a novel and very useful way. I've also been studying high level programming languages for the past five years or so and would say that I know the current state of the art feature set pretty well and 'know what I want from a language' and you hit the nail on the head with Q, at least from what I've read in the manual and the papers you've provided. Basically, it looks like I've found exactly what I've been looking for, so now I better put in the time to learn it :) > > so I'm glad that one finally exists that isn't > > putting kid gloves on me (Python), or concrete shoes (Haskell) and > > let's one 'hack' like you're supposed to :D > > Yes, Q's certainly intended as a hacker's tool, in Paul Graham's sense. > I love hacking away on problems, developing stuff from the bottom up, > and IMHO Q supports that style fairly well. Yes, hacker in the original, Lispy, working with data and code in a natural sense sort of way, which is the way that my style went after breaking the shackles of industrial programming (aka corporate and production). I write code to get the computer to do things for me, not programs per se, and a combo shell/high level langauge is going to open up new things that bash never could, and C was too tedious for (even with the meta programming system that I came up with). Ok, back to hacking so I can screw up and ask some more questions :) -- burton samograd kr...@gm... kruhft.boldlygoingnowhere.org www.myspace.com/kruhft |
From: Albert G. <Dr....@t-...> - 2006-08-24 11:54:52
|
Burton Samograd wrote: > Thanks for the very informative response to my newbie problems :) No problem. In fact those newbie questions are valuable input for the book about Q that I'm writing. I really have to add a "common pitfalls" chapter to the book where I describe the usual suspects and how to deal with them, and it's nice to have a ml archive which I can harvest for that. :) So keep the newbie questions coming... > 3 shows this week, work and remix contests Are you a musician? Q has quite a bit of stuff to offer there. Together with two colleagues, I'll be giving a talk on some of these interfaces at ICMC 2006 in New Orleans. > so I'm glad that one finally exists that isn't > putting kid gloves on me (Python), or concrete shoes (Haskell) and > let's one 'hack' like you're supposed to :D Yes, Q's certainly intended as a hacker's tool, in Paul Graham's sense. I love hacking away on problems, developing stuff from the bottom up, and IMHO Q supports that style fairly well. 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: Burton S. <kr...@gm...> - 2006-08-24 07:15:45
|
Hi Albert, Thanks for the very informative response to my newbie problems :) I'll be running with -w from now on, and will try not to rush my code so as to avoid silly typos (3 shows this week, work and remix contests to enter had me a bit short of time for my study of a new programming language, but I try and squeeze it in whenever I can find the time and energy, if only because I think Q is really fascinating and could be a very important part of my artistic arsenal in the future). One of the major thing attracting me to Q is the fact that it's "a very sharp knife" (which I can see from the design), and I know it will take some experience and practice before I can do some major surgery ;-) One of the major issues I have with current languages is lack of expressiveness, so I'm glad that one finally exists that isn't putting kid gloves on me (Python), or concrete shoes (Haskell) and let's one 'hack' like you're supposed to :D (after the initial learning curve that is) I appreciate your help very much with these issues; nothing like learning the language from the designer (and one that saved me 10 years of work by creating the language that I *was* designing until I found Q). -- burton samograd kr...@gm... kruhft.boldlygoingnowhere.org www.myspace.com/kruhft |
From: Albert G. <Dr....@t-...> - 2006-08-24 03:40:31
|
Hi Burton, thanks for the log, that cleared things up quite a bit. Looks like the computations are going ok now -- no more unevaluated cat applications, so I assume that these were actually due to the bug in 7.1/7.2 I mentioned, which is now fixed. But there are various bugs in your script which cause the behaviour that you see with --no-prelude. The bugs you were bitten by are not unusual, and I have some advice on how to avoid these pitfalls. Specifically, it might be a good idea to run your scripts with -w which warns you about function symbols that are used but neither defined (occurring on the lhs of an equation) nor explicitly declared anywhere. (There's also --pedantic a.k.a. -w2 which warns you about all function and free variable symbols which are not explicitly declared, but that's rather awkward since it forces you to declare each and every symbol.) I have my Emacs Q mode configured to always run the interpreter with -w, and of course you can also do the same on the command line with an alias. Running your script with --no-prelude -w gives: Warning cat, line 10: undeclared function symbol `issym' Warning cat, line 10: undeclared function symbol `prints' Warning cat, line 10: undeclared function symbol `putc' Warning cat, line 10: undeclared function symbol `fgetc' (The warnings are printed at the end of a script, that's why you always see line 10 up there. With --pedantic you get the warnings on the spot, for each first occurrence of an undeclared symbol.) Ok, so issym and prints aren't defined anywhere, but these are not the culprits here. But putc/fgetc are not defined either and this breaks your script with --no-prelude. These functions come from clib.q, and actually they are just aliases for writec/freadc, so replacing these for putc/fgetc will make the cat function work as intended, even with --no-prelude. BTW, this kind of bugs is rather symptomatic of Q, because function symbols are declared implicitly, and Q is perfectly happy with applications of undefined or partially defined functions; they're just normal forms. This is actually an essential feature of Q as a term rewriting language. In a more conventional language like Lisp or Haskell such bugs cause runtime or compile time errors. In Q, they can mostly be avoided with -w. Not always; Q is a sharp knife. ;-) More subtle problems which cannot be caught with -w/--pedantic have to do with Q's dynamic typing and unbounded ad-hoc polymorphism; there's no way to warn about these without severely restricting Q's expressiveness, so you'll have to resort to the debugger or unit tests to find them. Burton Samograd wrote: > [lots of debugger output snipped] > # just hangs here, and I have to hit ctl-c > <9> [~/.q] .Wed Aug 23 16:50:18. > q cat --no-prelude -d -c 'cat2 (fopen "cat" "r")' > ** fopen "cat" "r" ==> <<File>> > 0> cat, line 8: cat2 <<File>> ==> () if feof <<File>> > (type ? for help) > : c > cat F:String = cat_file (fopen F "r"); > C-c C-c! Break > >>>>cat2 (fopen "cat" "r") ^ > > # hangs here too So what happened here was that with --no-prelude fgetc never read anything, because it wasn't defined, hence feof never became true, and the cat function looped without actually doing anything else. And you saw the same symptom with the second definition, because in the second equation for cat2 you didn't recursively call cat2, but the flawed cat function. After fixing that cat2 worked ok for me. Just for the record, here is the corrected script: cat F:String = cat_file (fopen F "r"); cat F:File = cat_file F; cat F = cat_file (fopen (str F) "r") if issym F; = prints "cat: unsupported type"; cat_file F:File = () if feof F; = writec (freadc F) || cat F otherwise; cat2 F = () if feof F; = writes (freads F) || writes "\n" || cat2 F otherwise; (Well, obviously you still have to define prints somewhere, and copy the definition of issym from the standard library script typec.q if you want to run the script with --no-prelude.) BTW, another way to copy a text file, for the lazy programmer, is to use clib::fget which slurps an entire file in at once and returns it as a string. E.g.: 'cat F = fputs (fget F);'. There are also various low-level I/O functions in clib which allow arbitrary (possibly binary) files to be read and written in big chunks. 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: Burton S. <kr...@gm...> - 2006-08-23 22:55:33
|
I don't have too much time but here's a quick session using my current Q version, right from cvs (my comments start with a #): As can be seen, it works with no prelude, but now it just seems to hang without the prelude. This version of Q was pulled from CVS and built last night. Hopefully this might be of help. Oh, and I'm on a Pentium 4 running Gentoo with no wacky CFLAGS other than the -O2 -g defaults. This seems to be a strange problem, but I don't have any time right now to look more...I shall later. Hope this helps a bit. <9> [~] .Wed Aug 23 16:46:05. cd .q <9> [~/.q] .Wed Aug 23 16:46:08. cat cat cat F:String = cat_file (fopen F "r"); cat F:File = cat_file F; cat F = cat_file (fopen (str F) "r") if issym F; = prints "cat: unsupported type"; cat_file F:File = () if feof F; = putc (fgetc F) || cat F otherwise; cat2 F = () if feof F; = writes (freads F) || writes "\n" || cat F otherwise; <9> [~/.q] .Wed Aug 23 16:48:12. q cat -d -c 'cat (fopen "cat" "r")' ** clib::sys_vars ==> (1,2,4,...) -- def (SIZEOF_CHAR,SIZEOF_SHORT,SIZEOF_INT,...) = (1,2,4,...) -- def SIG_IGN = -1 -- def SIG_DFL = 0 -- def SIG_TRP = 1 -- def SCHED_OTHER = 0 -- def SCHED_RR = 1 -- def SCHED_FIFO = 2 -- def AF_UNIX = 1 -- def AF_FILE = 1 -- def S_ISUID = 2048 -- def S_ISGID = 1024 -- def S_ISVTX = 512 -- def S_IRWXU = 448 -- def S_IRUSR = 256 -- def S_IWUSR = 128 -- def S_IXUSR = 64 -- def S_IRWXG = 56 -- def S_IRGRP = 32 -- def S_IWGRP = 16 -- def S_IXGRP = 8 -- def S_IRWXO = 7 -- def S_IROTH = 4 -- def S_IWOTH = 2 -- def S_IXOTH = 1 ** this_thread ==> <<Thread>> -- def clib::MAIN_THREAD = <<Thread>> ** 1e+307*1e+307 ==> inf -- def inf = inf ** inf-inf ==> nan -- def nan = nan -- def i = complex 0 1 -- def NOARG = 0 -- def REQARG = 1 -- def OPTARG = 2 ** fopen "cat" "r" ==> <<File>> 0> cat, line 2: cat <<File>> ==> cat_file <<File>> cat F:String = cat_file (fopen F "r"); cat F:File = cat_file F; cat F = cat_file (fopen (str F) "r") if issym F; = prints "cat: unsupported type"; cat_file F:File = () if feof F; = putc (fgetc F) || cat F otherwise; cat2 F = () if feof F; = writes (freads F) || writes "\n" || cat F otherwise; () <9> [~/.q] .Wed Aug 23 16:49:02. q cat --no-prelude -d -c 'cat (fopen "cat" "r")' ** fopen "cat" "r" ==> <<File>> 0> cat, line 2: cat <<File>> ==> cat_file <<File>> (type ? for help) : c C-c C-c! Break >>> cat (fopen "cat" "r") ^ # just hangs here, and I have to hit ctl-c <9> [~/.q] .Wed Aug 23 16:50:18. q cat --no-prelude -d -c 'cat2 (fopen "cat" "r")' ** fopen "cat" "r" ==> <<File>> 0> cat, line 8: cat2 <<File>> ==> () if feof <<File>> (type ? for help) : c cat F:String = cat_file (fopen F "r"); C-c C-c! Break >>> cat2 (fopen "cat" "r") ^ # hangs here too |
From: Burton S. <kr...@gm...> - 2006-08-23 21:02:59
|
On 8/23/06, Albert Graef <Dr....@t-...> wrote: > Burton Samograd wrote: > > Is the Symbol type left out for a reason, or > > is it under a different name that I haven't found yet? Would there be > > any objection to adding it? > > Yes, in fact it would be fairly useful to have a Symbol type (and > subtypes FunSymbol and VarSymbol) for doing meta-programming, but that > interferes with Q's current type system which only has single > inheritance. Hence a constant symbol couldn't be a member of its own > (user-defined) type, which might have its own supertype, and the Symbol > type at the same time. So, until Q gets multiple inheritance, you'll > just have to put up with the issym function and friends. Makes sense. Thanks for the response. I'll make due without until then. -- burton samograd kr...@gm... kruhft.boldlygoingnowhere.org www.myspace.com/kruhft |
From: Albert G. <Dr....@t-...> - 2006-08-23 16:33:46
|
Burton Samograd wrote: > Is the Symbol type left out for a reason, or > is it under a different name that I haven't found yet? Would there be > any objection to adding it? Yes, in fact it would be fairly useful to have a Symbol type (and subtypes FunSymbol and VarSymbol) for doing meta-programming, but that interferes with Q's current type system which only has single inheritance. Hence a constant symbol couldn't be a member of its own (user-defined) type, which might have its own supertype, and the Symbol type at the same time. So, until Q gets multiple inheritance, you'll just have to put up with the issym function and friends. We've actually discussed the issue of multiple inheritance here a while ago and, looking at the code, I found that extending the construction algorithm for the pattern matching automaton to handle multiple supertypes is not straightforward. So I'm postponing this until I have a bytecode compiler written in Q itself (that's one of the reasons I'm working on Q Yacc and Lex), this will make it much easier to implement such changes. 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: Albert G. <Dr....@t-...> - 2006-08-23 16:18:19
|
Burton Samograd wrote: > I did just check your above code and my own code, and neither of them > run when the --no-prelude option is given (both return the "cat > <<File>>") but both work fine otherwise. Strange. What's your hardware platform? If you have the time, please do send me a debug log of the failing computation, i.e., with --no-prelude -d. Maybe I can then figure out what's going on there. > Yes, that is true; bugs always lurk, and I have to admit, I'm really > good at finding the obscure ones over the course of my lifetime ;-) Then you're most welcome here. ;-) What we really need now that Q slowly gains more traction is a lot of testing. Q has been quite stable for a while now, but in the 7.x series I added a bunch of important new features for which I had to touch almost every source module, so some fallout from these changes was to be expected. The new Q Yacc and Lex also keep shaking out compiler bugs, like program generators often do, so I'm planning to do another bugfix release as soon as I'm finished with those tools. It would be nice if this release could also address the issue that you encountered. 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 |