[Factor-talk] Pull request: correct indentation for SYMBOLS:, TUPLE: c. continuation lines in FUEL.
The following changes since commit fb98eaf9905126006e8c9e45ea1a29d175096c18: Jose A. Ortega Ruiz (1): FUEL: Fix stack effect font-lock. are available in the git repository at: http://git.hacks-galore.org/jao/factor.git emacs Jose A. Ortega Ruiz (2): FUEL: Use better defaults for factor's binary and image file. FUEL: Fix indentation of multiline TUPLE:, SYMBOLS: similar forms. extra/fuel/authors.txt |1 - misc/fuel/README |6 ++ misc/fuel/factor-mode.el |3 +-- misc/fuel/fu.el|6 +- misc/fuel/fuel-listener.el |6 -- misc/fuel/fuel-syntax.el | 33 - 6 files changed, 40 insertions(+), 15 deletions(-) -- Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Printing an HTTP response without accumulation
Thank you for the answer. I defined a new symbol to have access to stdout and then used with-output-stream* (doesn't work well without the * of course). Dynamic scope proves to be really useful. USING: kernel sequences combinators io io.sockets io.encodings.ascii prettyprint namespaces ; IN: scratchpad SYMBOL: old-output-stream output-stream get old-output-stream set www.google.com 80 inet ascii [ GET / HTTP/1.0\r\n\r\n write flush old-output-stream get [ [ . ] each-line ] with-output-stream* ] with-client Could you explain why output-stream get and output-stream get- global return different values ? ( scratchpad ) output-stream get --- Data stack: T{ pane-stream f ~pane~ } ( scratchpad ) output-stream get-global --- Data stack: T{ pane-stream f ~pane~ } T{ encoder f ~output-port~ utf8 } ( scratchpad ) Ludovic Kuty On 11 Jan 2009, at 21:54, Slava Pestov wrote: Hi, You can work with multiple streams at a time by using the stream-* words, instead of words such as readln. For example, readln is defined as : readln ( -- line ) input-stream get stream-readln ; If you use the stream-* version, you can pass the stream around on the stack or put it in a variable, and work with multiple streams. You still have to use with-disposal or with-destructors to ensure the streams get closed in the event of an error. Also, [ readln dup ] [ ] [ drop ] produce is the same same as input-stream get lines There is also an each-line combinator which applies a quotation to each line; this runs in constant space, instead of 'lines' which slurps everything into memory. Hope this helps, Slava On Sun, Jan 11, 2009 at 6:27 AM, Ludovic Kuty mail...@kuty.be wrote: Hello, I want to print the response given by a Web server using socket primitives (not an HTTP library). I managed to produce the following working code running in the factor Workspace. USING: io.sockets io.encodings.ascii ; www.google.com 80 inet ascii [ GET / HTTP/1.0\r\n\r\n write flush [ readln dup ] [ ] [ drop ] produce ] with-client [ . ] each But if I prefer to print the HTTP reponse directly in the quotation used by with-client instead of returning a result and then printing it with [ . ] each, what should I do ? Indeed the default input and output streams are rebound by with- client and thus inside the quotation I do not have access to stdout (the output stream to the console). It took me some time to realize this and have a working code. I thought of getting access to the output stream stored in the global namespace but it doesn't work (\ output- stream get-global). In fact that doesn't make sense maybe. I also thought of using with-output-stream but I can't see how to place it in the code since I need two different output-streams at the same time. Also, if you have any comment, insight or remark about the code, please let me know. Thank in advance, Ludovic Kuty OUTPUT: HTTP/1.0 302 Found Location: http://www.google.be/; Cache-Control: private Content-Type: text/html; charset=UTF-8 Set-Cookie: PREF =ID=db53d028f07bf514:TM=1231675166:LM=1231675166:S=x-4Mym8gM1pvKy6Y; expires=Tue, 11-Jan-2011 11:59:26 GMT; path=/; domain=.google.com Date: Sun, 11 Jan 2009 11:59:26 GMT Server: gws Content-Length: 218 HTMLHEADmeta http-equiv=\content-type\ content=\text/ html;charset=utf-8\ TITLE302 Moved/TITLE/HEADBODY H1302 Moved/H1 The document has moved A HREF=\http://www.google.be/\;here/A. /BODY/HTML -- Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Accessing multiple slots without using dup and swap
Hello, I saw that the stack effect of every slot reader slot is ( object -- value ). Thus the object is popped off the stack. If I want to get the value of another slot, I do not have the object to query it. So I have to dup it first. How can I do this the idiomatic way ? Suppose that I have a rectangle class defined as (code kept to a bare minimum for the sake of clarity): TUPLE: rectangle { width float } { height float } ; Now I define a method to calculate the area of a rectangle. Note the use of dup and swap to access both slots. I feel that there should be a better way to access them. M: rectangle area dup width swap height * ; I can use it like this: rectangle 100 width 50 height area . I thought of doing like this: SYMBOL: temp M: rectangle area temp [ temp get width temp get height * ] with-variable ; But now I have an implementation detail (the fact that temp is a symbol) that is leaking out of the method body. It doesn't feel right. I should be able to avoid SYMBOL and use \ temp but Factor curiously complains: Word not found in current vocabulary search path. The \ parsing word should avoid trying to execute the word. Any idea are welcome. Thank in advance, Ludovic Kuty -- Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Accessing multiple slots without using dup and swap
It looks like SYMBOL: can be used anywhere. Thus my example becomes: M: rectangle area SYMBOL: temp temp [ temp get width temp get height * ] with-variable ; And in fact \ temp has no meaning if temp is not defined somewhere. That's why \ + works but not \ not_defined. The documentation for DEFER: states that Due to the way the parser works, words cannot be referenced before they are defined. That answers my second question. However I'm not sure this is the correct way to express access to multiple slots. On 12 Jan 2009, at 15:55, Ludovic Kuty wrote: I thought of doing like this: SYMBOL: temp M: rectangle area temp [ temp get width temp get height * ] with-variable ; But now I have an implementation detail (the fact that temp is a symbol) that is leaking out of the method body. It doesn't feel right. I should be able to avoid SYMBOL and use \ temp but Factor curiously complains: Word not found in current vocabulary search path. The \ parsing word should avoid trying to execute the word. Any idea are welcome. -- Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Accessing multiple slots without using dup and swap
Hi Ludovic, You might want to check out the bi word. eg: M: rectangle area [ width ] [ height ] bi * ; There is a really nice tutorial at http://elasticdog.com/ Look under the 'combinators' part for a description of the bi (and other combinators) word. Thanks, Glenn V. Glenn Tarcea gtar...@umich.edu -Original Message- From: Ludovic Kuty [mailto:mail...@kuty.be] Sent: Monday, January 12, 2009 9:56 AM To: factor-talk@lists.sourceforge.net Subject: [Factor-talk] Accessing multiple slots without using dup and swap Hello, I saw that the stack effect of every slot reader slot is ( object -- value ). Thus the object is popped off the stack. If I want to get the value of another slot, I do not have the object to query it. So I have to dup it first. How can I do this the idiomatic way ? Suppose that I have a rectangle class defined as (code kept to a bare minimum for the sake of clarity): TUPLE: rectangle { width float } { height float } ; Now I define a method to calculate the area of a rectangle. Note the use of dup and swap to access both slots. I feel that there should be a better way to access them. M: rectangle area dup width swap height * ; I can use it like this: rectangle 100 width 50 height area . I thought of doing like this: SYMBOL: temp M: rectangle area temp [ temp get width temp get height * ] with-variable ; But now I have an implementation detail (the fact that temp is a symbol) that is leaking out of the method body. It doesn't feel right. I should be able to avoid SYMBOL and use \ temp but Factor curiously complains: Word not found in current vocabulary search path. The \ parsing word should avoid trying to execute the word. Any idea are welcome. Thank in advance, Ludovic Kuty -- Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Which Emacs to use on Mac?
Hi, Which Emacs do you recommend for use with Factor/FUEL on Mac OS X (Intel)? Is Aquamacs a good one? /Jon -- Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Which Emacs to use on Mac?
I use Emacs.app (from CVS emacs, checkout and build using ./configure --with-ns ) On Mon, Jan 12, 2009 at 1:47 PM, Jon Kleiser jon.klei...@usit.uio.no wrote: Hi, Which Emacs do you recommend for use with Factor/FUEL on Mac OS X (Intel)? Is Aquamacs a good one? /Jon -- Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Which Emacs to use on Mac?
I use Carbon Emacs which you can download from apple's site: http://www.apple.com/downloads/macosx/unix_open_source/carbonemacspackage.html I think it's more or less the same as Emacs.app from the CVS. Alex 2009/1/12 Jon Kleiser jon.klei...@usit.uio.no: Hi, Which Emacs do you recommend for use with Factor/FUEL on Mac OS X (Intel)? Is Aquamacs a good one? /Jon -- Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Emacs highlighting
Hi Jose, Here's a real nit-picky one: SYMBOLS: c d e f g t ; f and t are highlighted like they're false and true. This also happens in TUPLE:, VARS:, etc. Then there's the question of which ``f'' is in scope after the SYMBOLS: definition... Doug -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Accessing multiple slots without using dup and swap
SYMBOL: can be used anywhere, but you'll notice that if you define it within the M:, it's still available on the outside. It's generally considered contrary to coding conventions to put SYMBOL: within a word body, since it means the same thing as if it's outside of the word body. Dan On Mon, Jan 12, 2009 at 9:11 AM, Ludovic Kuty mail...@kuty.be wrote: It looks like SYMBOL: can be used anywhere. Thus my example becomes: M: rectangle area SYMBOL: temp temp [ temp get width temp get height * ] with-variable ; And in fact \ temp has no meaning if temp is not defined somewhere. That's why \ + works but not \ not_defined. The documentation for DEFER: states that Due to the way the parser works, words cannot be referenced before they are defined. That answers my second question. However I'm not sure this is the correct way to express access to multiple slots. On 12 Jan 2009, at 15:55, Ludovic Kuty wrote: I thought of doing like this: SYMBOL: temp M: rectangle area temp [ temp get width temp get height * ] with-variable ; But now I have an implementation detail (the fact that temp is a symbol) that is leaking out of the method body. It doesn't feel right. I should be able to avoid SYMBOL and use \ temp but Factor curiously complains: Word not found in current vocabulary search path. The \ parsing word should avoid trying to execute the word. Any idea are welcome. -- Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Calculator webapp, how to use?
Hi Jon, Sorry for the delay, this problem is fixed in latest git sources. There were two bugs, first of all Chloe templates would silently fail if an unknown tag was used, and the second problem was that calculator did not have furnace in its using list, so the vocabulary with furnace-specific chloe tags was not loaded (this includes t:form, etc). Slava On Thu, Jan 8, 2009 at 10:00 AM, Jon Kleiser jon.klei...@usit.uio.no wrote: Hi, I'm trying the calculator in /extra/webapps, but when it's running and I go to http://localhost:8080/, I only get a page saying Calculator. I can't figure out what to add to the URL to get something interesting on the screen. The source of the page I get is roughly this: ?xml version=1.0 encoding=UTF-8? head titleCalculator/title /head body h1Calculator/h1 /body That's all ... /Jon -- Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Pull request: Better word refactoring in Factor
This patch enhances fuel-refactor-extract-region (or sexp) in two ways: - Before asking for a new word, it scans the buffer for definitions that are equal to the words you're refactoring, offering the choice of using any of them instead of creating a new one. - After performing the refactoring in the current word, it asks you whether you would like to perform the same refactoring in other words which contain the same code. Of course, 'same code' is to be understood modulo whitespace and the like. Lightly tested, bug reports, as always, welcome. BTW, this was quite easy to implement: chalk it up to Factor being concatenative! The following changes since commit cbb91284c9b7dde71e2ecb45b38170cc42d1c3e4: Slava Pestov (1): Well-formed HTML for counter are available in the git repository at: http://git.hacks-galore.org/jao/factor.git emacs Jose A. Ortega Ruiz (1): FUEL: Better word extraction: detect existing words and extend refactoring. misc/fuel/fuel-refactor.el | 114 +++ 1 files changed, 92 insertions(+), 22 deletions(-) -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Emacs highlighting
Hi Doug. This is harder to fix than it seems, because Emacs' highlighting algorithm suffers performance-wise when matching multi-line regexps... i had to disable font lock of vocab names in USING: forms back in the day, but perhaps i was doing something silly. I'll give it a second try! Thanks, jao Doug Coleman doug.cole...@gmail.com writes: Hi Jose, Here's a real nit-picky one: SYMBOLS: c d e f g t ; f and t are highlighted like they're false and true. This also happens in TUPLE:, VARS:, etc. Then there's the question of which ``f'' is in scope after the SYMBOLS: definition... Doug -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Emacs highlighting
Speaking of multi-line regexps, Factor's string literals (...) are only single-line, however factor-mode highlights then as if they were multi-line. Perhaps an unterminated should highlight red until the end of the line, or something like that. Slava On Mon, Jan 12, 2009 at 6:10 PM, Jose A. Ortega Ruiz j...@gnu.org wrote: Hi Doug. This is harder to fix than it seems, because Emacs' highlighting algorithm suffers performance-wise when matching multi-line regexps... i had to disable font lock of vocab names in USING: forms back in the day, but perhaps i was doing something silly. I'll give it a second try! -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Which Emacs to use on Mac?
There are basically 3 options that I think are viable: 1: build your own CVS emacs ( too much effort for me ) 2: Aquamacs ( a lot like a mac app, not much like emacs, some annoying defaults ) 3: porkrind emacs (awesome) I cannot recommend porkrind emacs strongly enough. -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Pull request: M-. improvements and new M-, command
Patches below implement the new M-, command, which, when invoked after M-., brings you back to the point you were. In addition, the customizable variable 'fuel-edit-word-method' is used to decide how to open the word definition buffer when M-. is called: same window (useful now that we have M-,), other window or other frame (nil, 'window, 'frame respectively---M-x customize-variable will offer you a menu instead). Listed below are also the patch about refactoring and a fix for the string highlighting issues mentioned by Slava in a previous email. Thanks! --- The following changes since commit cbb91284c9b7dde71e2ecb45b38170cc42d1c3e4: Slava Pestov (1): Well-formed HTML for counter are available in the git repository at: http://git.hacks-galore.org/jao/factor.git emacs Jose A. Ortega Ruiz (3): FUEL: Better word extraction: detect existing words and extend refactoring. FUEL: Correct font-lock for string literals (no multiline). FUEL: M-. improvements and new M-,. misc/fuel/README|3 +- misc/fuel/fuel-edit.el | 36 -- misc/fuel/fuel-font-lock.el |7 ++- misc/fuel/fuel-mode.el |1 + misc/fuel/fuel-refactor.el | 114 ++ misc/fuel/fuel-syntax.el|8 ++- 6 files changed, 137 insertions(+), 32 deletions(-) -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Which Emacs to use on Mac?
On Jan 12, 2009, at 6:45 PM, Matthew Willis matthew.wil...@mac.com wrote: I got my emacs from here: http://atomized.org/wp-content/cocoa-emacs-nightly/ These are apparently nightly builds from emacs CVS. I like to use Emacs-app from MacPorts. It's probably not as up-to-date as these nightlies, but it integrates nicely with the rest of the utilities installed via MacPorts, such as various emacs utilities and extensions. -Brent -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk