Re: [Factor-talk] traslation
On Sun, 21 Aug 2011 23:49:10 +0400 Arkady Rost wrote: > Hi! I'm looking for a more elegant solution of the following task. > > for i in rangeA { > for j in rangeB { > foo(param, i, j); > } > bar(); > } > > I need to translate this to factor. > > foo(param, y, x) <=> x y param foo > > I have a solution: > rangeA rangeB param [ foo ] curry [ swapd [ call ] 2curry each bar ] > 2curry each > > For example, > rangeA = { "a" "b" "c" } > rangeB = { "1" "2" "3" } > param = " " > foo = append append write ; > bar = "" print ; > > { "a" "b" "c" } { "1" "2" "3" } " " [ append append write ] curry > [ swapd [ call ] 2curry each "" print ] 2curry each > > Result is : > 1a 2a 3a > 1b 2b 3b > 1c 2c 3c > > I think my solution is bloated with partial applications. Maybe > someone can provide a better way to solve this task. > > Cheers, > Ark. Rost Hi Arkady This should work: : blob ( ys xs param quot: ( y x param -- ) -- ) '[ _ [ _ _ call ] with each bar ] each ; inline example usage (assuming : bar ( -- ) "abc" print ;) ( scratchpad ) { 1 2 3 } { 4 5 6 } 7 [ 3array . ] blob { 1 4 7 } { 1 5 7 } { 1 6 7 } abc { 2 4 7 } { 2 5 7 } { 2 6 7 } abc { 3 4 7 } { 3 5 7 } { 3 6 7 } abc -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Pull Request
Hi Slava and everyone else As I'm still waiting for the non-gtk native image loader branch to be merged, and people were keeping mentioning that game input was broken for the gtk backend, I decided to cherry pick the game input related branches into a new branch here: https://github.com/blei/factor/tree/gtk-game-input Kenanb from IRC and me have tested the changes, at least the samples in the factor repo work now. Greetings Philipp -- Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] game.input no longer works on X11 (possibly due to gtk backend)
On Fri, 18 Mar 2011 11:11:52 +0100 Philipp Brüschweiler wrote: > On Thu, 17 Mar 2011 20:20:07 -0700 > Slava Pestov wrote: > > Hi Philipp, > > > > I tried to merge your branch but there were a number of conflicts. > > Can you please rebase the code on top of the latest sources and > > push to a new branch? > > > > Slava > > Hi Slava, > > I tried to do that right now, but the problem is that I the > native-image-loader branch by Joe doesn't even merge cleanly with the > latest sources. Joe changed some things in how enums are handled and I > don't feel comfortable resolving these conflicts as I don't know much > about this part of factor. I'll happily try to rebase my code after > the native-image-loader branch has been merged. > > Greetings > Philipp That was supposed to go to the mailing list. Sorry about the duplicate mail, Slava. Philipp -- Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] game.input no longer works on X11 (possibly due to gtk backend)
On Mon, 14 Mar 2011 17:43:36 -0700 Joe Groff wrote: > kenanb in #concatenative noted that game.input fails with a memory > protection fault with a recent Linux build of Factor. Here is a > backtrace: > > http://paste.factorcode.org/paste?id=2208 > > From the backtrace, it appears that some required X11 state is > missing. kenanb tested a binary from before the gtk backend merge > that worked, so it seems like a likely candidate. If gtk or gdk offer > keyboard state polling and relative mouse input APIs, then a gtk > backend for game.input would be useful; otherwise, the existing x11 > backend might need to be modified to work with the X11 state as set > up by gtk. > > -Joe Hi everyone IIRC I implemented GTK based game-input in my branch on github https://github.com/blei/factor/tree/gtk-image-loader I'm not sure if it implements all of the required functionality, and I don't have time to check right now... Maybe some of you can look at it? Greetings Philipp -- Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] newbie: cannot follow a tutorial
On Wed, 28 Jul 2010 22:23:21 +0200 Jon Harper wrote: > Hi, > Like they said in the comments, you need to set the "message" slot of > the response. > > USING: http http.server threads furnace.actions ; > [ httpd ] in-thread > [ > >200 >>code >"text/plain" >>content-type >"Hello World" >>body >"Success" >>message > ] >>display main-responder set-global > > However, if you look at all the webapps shipped with factor (search > for webapps in the help browser), all of them are using Chloe > templates. I think you should take a look at these and see if Chloe > templates are enough for your needs. Chloe templates are supposed to > be easier to use than http responses. > > Cheers, > Jon Arguably that's a bug in M: encoder stream-write though. The code fails in write-response-line when it tries to write f. The documentation of write on the other hand explicitly allows f as input. -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Fixes for png loading and xim input methods
On Tue, 1 Jun 2010 14:05:45 +0200 Philipp Brüschweiler wrote: > Hi Slava > > For the PNG fix, I pushed a new version with the changes you > suggested: > > http://github.com/Blei/factor > > Bootstrap works, png loading works. Ping. Are there still problems I should fix in this commit? Philipp -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Fixes for png loading and xim input methods
On Mon, 31 May 2010 19:47:41 -0400 Slava Pestov wrote: > Hi Philipp, > > At some point our XIM backend used the Xutf8* functions but then I > switched to Xwc, I think because the utf8 version was buggy on some > *nix or another. Now you're changing it back. What's the rationale > behind this change? > > Also you use with-out-parameters for an int and XAtom, but malloc an > out parameter buffer. You can do this though, > > { { char buf-size } KeySym int } [ > :> ( buf keysym status ) > ... > ] with-out-parameters > > as long as buf-size is a constant, you can have a stack-allocated > array of that size. > > I think the plan is to replace the X11 backend with Anton's Gtk > backend in the near future. So there's nothing to gain from doing any > additional engineering work on the X11 backend. > > As for the PNG fix, I understand that there is a bug, but the fix > seems a bit overdesigned and also tacked on. Is it really necessary to > save and restore the pack alignment when creating every texture? Why > not set it once for the entire Factor UI in the init-gl word of the > ui.render vocabulary? > > Slava Hi Slava For the PNG fix, I pushed a new version with the changes you suggested: http://github.com/Blei/factor Bootstrap works, png loading works. > At some point our XIM backend used the Xutf8* functions but then I > switched to Xwc, I think because the utf8 version was buggy on some > *nix or another. Now you're changing it back. What's the rationale > behind this change? The man-page for XwcLookupString says: "Both XmbLookupString and XwcLookup‐ String return text in the encoding of the locale bound to the input method of the specified input context, and Xutf8LookupString returns text in UTF-8 encoding." The current code instead unconditionally decodes the returned string as utf16n, which presumably makes it fail the 'valid-input?' test and breaks input methods (or at least my input method). So I thought nice fix would be to use Xutf8.. instead. If this function is broken then the proper fix would be to find the encoding the input method is bound to. A quick test using XmbLookupString and utf8 (my local encoding) works. But if you don't want to sink time into x11, then i'll just use this fix locally. Thanks for your time! -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Fixes for png loading and xim input methods
Hi all The headline says it all. Look at the patches here: http://github.com/Blei/factor I'm not sure if the png and texture fix created bugs (bootstrap works though), please tell me if that is the case. Cheers -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Problem with UI and XIM
On Sun, 16 May 2010 21:04:57 +0400 Danya Alexeyevsky wrote: > Hello, > > I've just started learning factor and bumped right into problem with > UI: most of attempts to run ./factor with ui produces the following > error: > > Error in thread 16 (UI update, [ self ui-thread set-global > update-ui-loop ]): > > Memory protection fault at address 7ff0d7f4e32a > > (U) Quotation: [ set-namestack init-catchstack self quot>> call -> > stop ] (O) Word: update-ui-loop > (O) Word: update-ui > (O) Word: notify-queued > (O) Method: M\ world graft* > (O) Method: M\ x11-ui-backend (open-window) > (O) Word: gadget-window > (O) Word: create-xic > (O) Word: XCreateIC > (U) Quotation: [ > 63 special-object error-thread set-global > continuation -> error-continuation set-global > [ original-error set-global ] [ rethrow ] bi > ] > > The error sometimes occur upon starting factor, sometimes it occus > upon UI trying to open a new window, and possibly the same error > sometimes occurs in process of drawing listener but in the latter case > nothing is printed on the console. > > I built factor from sources using build-support/factor.sh update, > using branch clean-linux-x86-64. > > I'm using X11 with SCIM XIM. I've tried running in X11 without SCIM > (within another account on a system) and the error occurs much less > frequently, but it still does occur. > > I'm not familiar with XIM programming, and I have yet no understanding > of how factor vm works, so any hints on how to debug the problem are > welcome. Or if anyone can suggest a way to disabling xim in factor, > that would be great too. (I actually don't see much sense in > programming environment using XIM). > > Cheers, > -- Danya. When did you last update factor? The same thing happened to me yesterday, but the most recent commit fixed it (it is even mentioned in the commit message). -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] test runs fine when manually typed into listener but fails when invoked
Am Fri, 26 Feb 2010 09:56:38 -0500 schrieb Terrence Brannon : > I dont understand why I can type the input quotation into the listener > and get back a result, yet I get "Data stack underflow" when I type > > (listener) "data-maker.field.from-format" unit-test I think you want to do this instead "data-maker.field.from-format" test > > My actual source code is > [here](http://gitorious.org/project_factor/data-maker/trees/master/field/from-format) > but the problematic test case is below. > > > USING: data-maker.field.from-format tools.test ; > IN: data-maker.field.from-format.tests > > [ t ] [ "George (\\d\\d\\d)" next ] unit-test > > ! [ t ] > ! [ DELIMITED: > ! Terrence (\d\d\d) \d\d\d-\d\d\d\d > !next > ! ] unit-test > > -- > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Not getting MACRO:
Am Thu, 14 Jan 2010 23:17:04 -0800 schrieb Jim mack : > Hi. Can you please help me understand why the final line here > results in a stack underflow? > > USING: accessors arrays kernel locals present select8.html > classes.tuple sequences prettyprint fry macros nested-comments > combinators ; > > TUPLE: testing id firstname lastname age ; > : ( id fn ln age -- tpl ) testing boa ; > : testdata ( -- tpl ) 1 "jim" "mack" 46 ; > : testing-schema ( -- seq ) > { { "First Name " [ firstname>> ] } > { "Last Name " [ lastname>> ] } > { "Age " [ age>> ] } } ; > > : non-macro-way ( tpl -- ) > { > [ "First Name " write firstname>> print ] > [ "Last Name " write lastname>> print ] > [ "Age " write age>> present print ] > } cleave ; > > testdata non-macro-way > > ! using fry > > testdata { } clone > testing-schema [ first2 '[ _ write @ present print ] suffix ] each > cleave > > MACRO: easier ( alist -- ) { } clone swap > [ first2 '[ _ write @ present print ] suffix ] each cleave ; > > : fancyprint ( tpl -- ) > testing-schema easier ; inline > > testdata fancyprint ! stack underflow Hi Jim If I understand you correctly, your intent is that fancyprint will be the same as non-macro-way, just with dynamically generated code. If so, your problem is that you don't generate a quotation as output of the macro, specifically the call to cleave gets executed at parse time. Here's a correct version (with { } clone swap [ .. suffix ] each simplified to map): MACRO: easier ( alist -- ) [ first2 '[ _ write @ present print ] ] map '[ _ cleave ] ; For fancyprint to work, you have to declare testing-schema inline, make a CONSTANT: out of it or directly write the alist into fancyprint. Cheers -- Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] [PATCH] fix for math.parser
Hi all A quick fix for base> . I'm not sure I'm not breaking compatibility with the old (broken according to the documentation) behaviour of base>. But at least it's a start.>From 459e6a5e3e87b4b704bb51af814f2461ff21a8de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Br=C3=BCschweiler?= Date: Mon, 4 Jan 2010 17:59:14 +0100 Subject: [PATCH] math.parser: fix base> with radix > 16 --- core/math/parser/parser-tests.factor |3 +++ core/math/parser/parser.factor |4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/math/parser/parser-tests.factor b/core/math/parser/parser-tests.factor index 34bca8a..95a31f6 100644 --- a/core/math/parser/parser-tests.factor +++ b/core/math/parser/parser-tests.factor @@ -104,6 +104,9 @@ unit-test [ f ] [ "fdsf" bin> ] unit-test [ 3 ] [ "11" bin> ] unit-test +[ 1952666161 ] [ "WAKEUP" 36 base> ] unit-test +[ "sheeple" ] [ 62002031378 36 >base ] unit-test + [ f ] [ "\0." string>number ] unit-test [ 1 1 >base ] must-fail diff --git a/core/math/parser/parser.factor b/core/math/parser/parser.factor index f04c010..bc6a898 100644 --- a/core/math/parser/parser.factor +++ b/core/math/parser/parser.factor @@ -10,7 +10,7 @@ IN: math.parser { [ dup CHAR: a < ] [ CHAR: A 10 - - ] } [ CHAR: a 10 - - ] } cond -dup 0 < [ drop 255 ] [ dup 16 >= [ drop 255 ] when ] if ; inline +dup 0 < [ drop 255 ] [ dup 36 >= [ drop 255 ] when ] if ; inline : string>digits ( str -- digits ) [ digit> ] B{ } map-as ; inline @@ -93,7 +93,7 @@ SYMBOL: negative? } case ; inline : number-char? ( char -- ? ) -"0123456789ABCDEFabcdef." member? ; inline +"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz." member? ; inline : last-unsafe ( seq -- elt ) [ length 1 - ] [ nth-unsafe ] bi ; inline -- 1.6.6 -- This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] [PATCH] ui.gadgets.tracks: clarify documentation of track-add
I'm not completely sure if this is correct though. And please don't hesitate to correct any language errors. --- basis/ui/gadgets/tracks/tracks-docs.factor |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/basis/ui/gadgets/tracks/tracks-docs.factor b/basis/ui/gadgets/tracks/tracks-docs.factor index cf5c94a..4ead88f 100644 --- a/basis/ui/gadgets/tracks/tracks-docs.factor +++ b/basis/ui/gadgets/tracks/tracks-docs.factor @@ -19,6 +19,8 @@ HELP: HELP: track-add { $values { "track" track } { "gadget" gadget } { "constraint" "a number between 0 and 1, or " { $link f } } } -{ $description "Adds a new child to a track. If the constraint is " { $link f } ", the child always occupies its preferred size. Otherwise, the constrant is a fraction of the total size which is allocated for the child." } ; +{ $description "Adds a new child to a track. If the constraint is " { $link f } ", the child always occupies its preferred size. Otherwise, the size of the child is determined by it's constraint compared to other children with a non-" { $link f } " constraint." +$nl +"For example, suppose a track has three children with constraints " { $link f } ", " { $snippet "0.2" } " and " { $snippet "0.4" } ". Now the size of the first child will be constant and the size of the second child will be half the size of the third child." } ; ABOUT: "ui-track-layout" -- 1.6.5.6 -- This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] at* parameters
Am Tue, 3 Feb 2009 08:36:25 -0500 schrieb Steve Weeks : > Until the stack effect of at* changes, I've been using: > > : at? ( key assoc -- value/key ? ) 2dup key? [ at* ] [ drop f ] if ; > How about: : at? ( key assoc -- value/key ? ) dupd at* [ nip t ] [ drop f ] if ; That should be faster, as key? calls at* already once. -- Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk