Re: [Factor-talk] Ubuntu 15.04
Compiling from source works for me, and that is fine for now. Still I wonder about the memory errors :-? 2015-10-25 10:24 GMT+01:00 Martin Saurer <martin.sau...@bluewin.ch>: > Have you tried compiling factor from source, then load the boot image? > > On my Ubuntu 15.10 both 0.97 and latest from git work nice. > > Best > > Martin > > -Ursprüngliche Nachricht- > Von: Andrea Ferretti [mailto:ferrettiand...@gmail.com] > Gesendet: Freitag, 23. Oktober 2015 15:07 > An: factor-talk@lists.sourceforge.net > Betreff: Re: [Factor-talk] Ubuntu 15.04 > > Unfortunately, still getting the error on devel > > 2015-10-23 15:00 GMT+02:00 Andrea Ferretti <ferrettiand...@gmail.com>: >> Ok, it seems it depends on my Nvidia drivers. Launching 0.97 with the >> gtk.ffi fix gave a more detailed explanation of the error >> >> Thank you! >> >> 2015-10-23 14:44 GMT+02:00 John Benediktsson <mrj...@gmail.com>: >>> Sorry, it is: >>> >>>"gtk.ffi" reload save >>> >>> >>>> On Oct 23, 2015, at 5:40 AM, John Benediktsson <mrj...@gmail.com> wrote: >>>> >>>> For 0.97, can you try: >>>> >>>> $ ./factor -run=listener >>>>IN: scratchpad "gtk" reload save >>>> >>>> Then quit and try the UI again? >>>> >>>> We will have to investigate the error with latest git master. >>>> >>>> >>>>> On Oct 23, 2015, at 2:27 AM, Andrea Ferretti <ferrettiand...@gmail.com> > wrote: >>>>> >>>>> I have tried, without chance, to run factor on Ubuntu 15.04 (and I >>>>> will move to 15.10 soon). >>>>> >>>>> The 0.97 version fails with >>>>> >>>>> Cannot resolve C library function >>>>> Library: DLL" /usr/lib/libgtk-x11-2.0.so.0" >>>>> Symbol: gtk_init >>>>> >>>>> >>>>> On the dev version I get a memory error: >>>>> >>>>> An error occurred while drawing the world T{ world f ~array~ >>>>> ~array~ f f ~vector~ ~array~ ~debugger~ t t f >>>>> This world has been deactivated to prevent cascading errors. >>>>> Memory protection fault at address 7f920fce6360 >>>>> >>>>> Is there anyone using Factor on latest Ubuntu? >>>>> >>>>> --- >>>>> --- ___ >>>>> Factor-talk mailing list >>>>> Factor-talk@lists.sourceforge.net >>>>> https://lists.sourceforge.net/lists/listinfo/factor-talk >>> >>> - >>> - ___ >>> Factor-talk mailing list >>> Factor-talk@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/factor-talk > > > -- > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > > > -- > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Ubuntu 15.04
I have tried, without chance, to run factor on Ubuntu 15.04 (and I will move to 15.10 soon). The 0.97 version fails with Cannot resolve C library function Library: DLL" /usr/lib/libgtk-x11-2.0.so.0" Symbol: gtk_init On the dev version I get a memory error: An error occurred while drawing the world T{ world f ~array~ ~array~ f f ~vector~ ~array~ ~debugger~ t t f This world has been deactivated to prevent cascading errors. Memory protection fault at address 7f920fce6360 Is there anyone using Factor on latest Ubuntu? -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Ubuntu 15.04
Unfortunately, still getting the error on devel 2015-10-23 15:00 GMT+02:00 Andrea Ferretti <ferrettiand...@gmail.com>: > Ok, it seems it depends on my Nvidia drivers. Launching 0.97 with the > gtk.ffi fix gave a more detailed explanation of the error > > Thank you! > > 2015-10-23 14:44 GMT+02:00 John Benediktsson <mrj...@gmail.com>: >> Sorry, it is: >> >>"gtk.ffi" reload save >> >> >>> On Oct 23, 2015, at 5:40 AM, John Benediktsson <mrj...@gmail.com> wrote: >>> >>> For 0.97, can you try: >>> >>>$ ./factor -run=listener >>>IN: scratchpad "gtk" reload save >>> >>> Then quit and try the UI again? >>> >>> We will have to investigate the error with latest git master. >>> >>> >>>> On Oct 23, 2015, at 2:27 AM, Andrea Ferretti <ferrettiand...@gmail.com> >>>> wrote: >>>> >>>> I have tried, without chance, to run factor on Ubuntu 15.04 (and I >>>> will move to 15.10 soon). >>>> >>>> The 0.97 version fails with >>>> >>>> Cannot resolve C library function >>>> Library: DLL" /usr/lib/libgtk-x11-2.0.so.0" >>>> Symbol: gtk_init >>>> >>>> >>>> On the dev version I get a memory error: >>>> >>>> An error occurred while drawing the world T{ world f ~array~ ~array~ f >>>> f ~vector~ ~array~ ~debugger~ t t f >>>> This world has been deactivated to prevent cascading errors. >>>> Memory protection fault at address 7f920fce6360 >>>> >>>> Is there anyone using Factor on latest Ubuntu? >>>> >>>> -- >>>> ___ >>>> Factor-talk mailing list >>>> Factor-talk@lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/factor-talk >> >> -- >> ___ >> Factor-talk mailing list >> Factor-talk@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Ubuntu 15.04
Ok, it seems it depends on my Nvidia drivers. Launching 0.97 with the gtk.ffi fix gave a more detailed explanation of the error Thank you! 2015-10-23 14:44 GMT+02:00 John Benediktsson <mrj...@gmail.com>: > Sorry, it is: > >"gtk.ffi" reload save > > >> On Oct 23, 2015, at 5:40 AM, John Benediktsson <mrj...@gmail.com> wrote: >> >> For 0.97, can you try: >> >>$ ./factor -run=listener >>IN: scratchpad "gtk" reload save >> >> Then quit and try the UI again? >> >> We will have to investigate the error with latest git master. >> >> >>> On Oct 23, 2015, at 2:27 AM, Andrea Ferretti <ferrettiand...@gmail.com> >>> wrote: >>> >>> I have tried, without chance, to run factor on Ubuntu 15.04 (and I >>> will move to 15.10 soon). >>> >>> The 0.97 version fails with >>> >>> Cannot resolve C library function >>> Library: DLL" /usr/lib/libgtk-x11-2.0.so.0" >>> Symbol: gtk_init >>> >>> >>> On the dev version I get a memory error: >>> >>> An error occurred while drawing the world T{ world f ~array~ ~array~ f >>> f ~vector~ ~array~ ~debugger~ t t f >>> This world has been deactivated to prevent cascading errors. >>> Memory protection fault at address 7f920fce6360 >>> >>> Is there anyone using Factor on latest Ubuntu? >>> >>> -- >>> ___ >>> Factor-talk mailing list >>> Factor-talk@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/factor-talk > > -- > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Why does numberstring append .0 on my German system ?
By the way, I do not think it is a good idea to directly parse or format numbers based on locale, for portability. I would rather have different functions that also take a locale into account (not necessarily the system one) and a constant with the system locale 2015-08-14 18:52 GMT+02:00 Jon Harper jon.harpe...@gmail.com: For info, it works directly on x86 linux Jon On Fri, Aug 14, 2015 at 6:17 AM, Georg Simon georg.si...@auge.de wrote: For me the need lies in the future. I am using a Factor written todo list editor, primarily to learn to use the Factor UI. I now add deadlines. So I want to display numbers in a Factor table. It would have been proper to display them locale dependant, but it is not necessary for now. Am Fri, 14 Aug 2015 00:01:20 +0200 schrieb Jon Harper jon.harpe...@gmail.com: So I looked into this, trying to solve it by calling printf through the FFI with a locale setup and cleanup. The difficulty comes from the fact that printf is a variadic function.. Factor's ffi doesn't support them, at least no in a cross platform manner, right? So a workaround could be to wrap printf in C many times, compile that to a shared library and call the different wrappers with the FFI depending on the number of arguments and their types, but it would be nicer to have a better support of variadic functions. Anyway, it (kind of) worked on linux x86_64 with the following code: http://paste.factorcode.org/paste?id=3584 Since printf is a variadic function, you have to use FUNCTION-ALIAS to create functions with the correct number of arguments and the correct types. So for example, FUNCTION-ALIAS: mysnprintf-int2 int snprintf ( char* result, size_t size, c-string format, int d, int d2 ) would work too. However, passing floats didn't work on linux x86_64, because the system V AMD64 ABI says that the number of float arguments must be in RAX before calling the function, and factor always sets this to 0. With the following diff, it worked for 1 float: in cpu/x86/64/64.factor (and basis/cpu/x86/64/64.factor ??) -M: x86.64 %prepare-var-args ( -- ) RAX RAX XOR ; +M: x86.64 %prepare-var-args ( -- ) RAX 1 MOV ; I don't know how hard it would be to generate the correct value for RAX for variable arguments. Also, I'm not sure if it works better for other ABI/platforms. Do you think that's something worth investigating ? Jon On Wed, Aug 12, 2015 at 7:10 AM, Georg Simon georg.si...@auge.de wrote: Am Tue, 11 Aug 2015 09:02:33 -0700 schrieb John Benediktsson mrj...@gmail.com: Thank you. So I didn't overlook existing locales support. Properly supporting locales, even in a small way, would be a good thing to add. Factor is currently locale-independent, partly because of a desire for homoiconicity, and partly because it prevents things like tests that break depending on the system locale[1]. We have discussed adding a locale vocabulary or a with-locale combinator that can influence presentation of numbers and strings, maybe looking at how other languages work[2]. Probably we'd want to keep the math.parser locale independent, but provide ways for things like present / printf to be locale-aware. If this is an issue for something you are building, you could use alien.ffi to call sprintf or use C++ stringstream or something and call the library from Factor, or do something slow like this, calling out to Python: : format-with-locale ( n locale -- s ) swap [ python , -c , import locale; locale.setlocale(locale.LC_ALL, \%s\); print(locale.format(\%%f\, %s)) sprintf , ] { } make B utf8 [ readln ] with-process-reader ; IN: scratchpad 1.5 fr_FR format-with-locale . 1,50 --- [1] https://github.com/slavapestov/factor/issues/905 [2] https://docs.python.org/3/library/locale.html -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Advice for talk
Great, set-listener-font is exactly what I needed! About 1, I was meaning something different. It was an experimental UI gadget that would show the (speculative) status of the stack while the user keeps entering words. Or maybe my memory is at fault 2015-03-12 15:50 GMT+01:00 John Benediktsson mrj...@gmail.com: 2) I also remember a discussion about making the font in the listener bigger (I gave a talk at work, in order to prepare for the conference, and I ended up having to decrease the resolution in order for everyone to see, but then some contextual menus were partially hidden). IN: scratchpad Monospace 16 set-listener-font Also, you can use Cmd/Alt and +/- to increase the font sizes in the browser which might help if you show of documentation. I meant to make the listener windows support that key binding as well, but wanted to refactor the way interactor streams worked before doing that. Best, John. -- Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Advice for talk
Hi, I was preparing a talk about Factor, and I recall having seen mentioned on this list two things that might turn out useful for the presentation. Unfortunately, I cannot find them anymore. 1) I remember someone mentioned a tool that would show the speculative status of the stack in realtime while entering words. 2) I also remember a discussion about making the font in the listener bigger (I gave a talk at work, in order to prepare for the conference, and I ended up having to decrease the resolution in order for everyone to see, but then some contextual menus were partially hidden). Any chance someone with better memory/google fu than I have can find pointers to the previous discussions? -- Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Talk about Factor
Wow, lots of ideas! Unfortunately, I cannot find anymore in your repository the Google charts and TeX rendering stuff. Any chance there is still something working? 2015-01-29 21:01 GMT+01:00 John Benediktsson mrj...@gmail.com: I think your tutorial will provide a good base for a presentation! There are a couple of talks available to look at: extra/chicago-talk extra/galois-talk extra/google-tech-talk extra/jvm-summit-talk extra/minneapolis-talk extra/otug-talk extra/tc-lisp-talk extra/vpri-talk And a few more on github: https://github.com/slavapestov/emerging-langs-talk https://github.com/slavapestov/boston-lisp-talk Probably some of those are a little stale, but it might give you some ideas. It's not particular unique, but I've always liked to highlight the visual REPL, and Google Charts makes a good example of that: http://re-factor.blogspot.com/2010/09/visual-repl.html http://re-factor.blogspot.com/2011/03/google-charts.html Using an inline assembly DSL: http://re-factor.blogspot.com/2010/11/estimating-cpu-speed.html People sometimes have some difficulty with concatenative syntax in the beginnings, so (while not recommended for all code) it's nice to show examples of using locals to implement something, like this: http://re-factor.blogspot.com/2014/06/quicksort.html Here's an example where #concatenative helped me improve on too many stack shuffle words: http://re-factor.blogspot.com/2010/05/evenly-partition-integer.html There are a lot of libraries available in the tree, but I would imagine you want to highlight the language more than the available libraries. It might be neat to walk through implementing something in real time, or at least go through slides showing the development of something from scratch. Progressive optimization, finally using SIMD for sped: http://re-factor.blogspot.com/2011/11/wc-l.html Anyway, other stuff might be network servers, here's a super simple telnet server in a couple lines of code: https://github.com/mrjbq7/re-factor/blob/master/telnet-server/telnet-server.factor And a paper presented at DLS 2010: http://factorcode.org/littledan/dls.pdf Anyway, good luck! Let us know how it goes! Best, John. On Thu, Jan 29, 2015 at 9:19 AM, Andrea Ferretti ferrettiand...@gmail.com wrote: Hi, I will be giving an introductory talk about Factor at the LambdaCon in Bologna (Italy) http://www.lambdacon.org/ Of course, I a not a Factor expert in any way, but I will make it clear and try to show the potentialities of Factor. I was thinking of following more or less parts of my tutorial http://andreaferretti.github.io/factor-tutorial/ with some variations - a nice one would be the implementation of K-means here https://github.com/andreaferretti/kmeans/blob/master/factor/kmeans/kmeans.factor that I find quite neat :-) I was also planning to let people download Factor and follow interactively, which should be quite possible since Factor is rather succinct. I would like to gather some advice from more experienced factorers: what topics to choose? Do you have any experience in presenting Factor to a general audience? Any things that may appeal and capture the audience attention? -- Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net
[Factor-talk] Talk about Factor
Hi, I will be giving an introductory talk about Factor at the LambdaCon in Bologna (Italy) http://www.lambdacon.org/ Of course, I a not a Factor expert in any way, but I will make it clear and try to show the potentialities of Factor. I was thinking of following more or less parts of my tutorial http://andreaferretti.github.io/factor-tutorial/ with some variations - a nice one would be the implementation of K-means here https://github.com/andreaferretti/kmeans/blob/master/factor/kmeans/kmeans.factor that I find quite neat :-) I was also planning to let people download Factor and follow interactively, which should be quite possible since Factor is rather succinct. I would like to gather some advice from more experienced factorers: what topics to choose? Do you have any experience in presenting Factor to a general audience? Any things that may appeal and capture the audience attention? -- Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] A stub of a package manager
I would like to spark a little discussion: is a package manager seen as something useful? Is it needed at this time? Could it be reasonably implemented using symlinks? (Kind of what Npm does). I do not want to push something if the community does not feel the need for it - at least at the moment. At the same time, I would like very much to help if I can. I took the freedom to stub a package manager because for me it was one of the main issue in really adopting Factor, but others may feel otherwise 2014-12-19 10:52 GMT+01:00 Andrea Ferretti ferrettiand...@gmail.com: Hi Björn, great points! Let me try to comment on them. 2014-12-19 5:14 GMT+01:00 Björn Lindqvist bjou...@gmail.com: Great work Andrea! Factor needs a package management system eventually. Programmers have this strange infatuation with packages and unless the language offers it, it's just not taken seriously. Maybe because people are customed to the language core being almost closed and the bar uber high for contributions so people feel they need to release their own packages to contribute. I think Factor's community is more open than that and John and Doug are amazingly responsive on the bug tracker. So if you have any worthwhile code to contribute, just make a pull request and it will be merged quickly. Then you'll get code maintenance for free in case the language changes and your test suite is setup to run nightly which catches bugs. I am sure that John and Doug are doing a fantastic work! The use case I imagined a package manager would be useful, though, is slightly different. First, in a typical corporate setting, there may be a need to mantain different versions of a library at a time. Upgrading all clients of the library may not be feasible because of manpower. It often happens that Mr. A writes a first version of a library acme-lib which is used by Mr B to write acme-webapp,. Then Mr. A releases a much improved version of acme-lib, and everyone at acme uses it, but unfortunately the API has changed a lot. acme-webapp is now in manteinance mode, and Mr. B just left to found his own startup. There should be a way to keep working on acme-webapp - say to fix vulnerabilities - without requiring a complex refactoring just to move to the new version of acme-lib. In other words, there should be two co-existent versions of acme-lib, and clients should be free to decide which one to use and upgrade at their own pace. Second, and possibly more important, versions do exist externally. For instance, I was thinking about writing a library to talk with the Kafka messaging system. The binary protocol of Kafka has changed between versions 0.7 and 0.8. If I had implemented a Kafka library for Factor before 0.8 came out, I may now have the need to upgrade it to support 0.8, without losing the possibility to connect to 0.7 clusters. So I tried to get your package manager to work, but something goes wrong: USE: packages.example example-project activate Added packages.projects vocabulary to search path More than one file found for vocabulary: example-project Type :help for debugging help. If you are using the version in https://github.com/andreaferretti/factor-packages - which I left unchanged so that people can try it without issues, it should be USE: packages.projects packages.example activate There may be an issue with the error message, but error reporting is just not there yet. Let me know if it works for you Maybe the code is in flux? Anyway, here are some random thoughts about your implementation: * You can't have one voacb root per package. If you run threads. in the listener, you'll see that there is one thread for each of the three roots. They monitor that directory tree and reloads vocabs that change automatically. See http://docs.factorcode.org/content/article-vocabs.refresh.html So yes, there are performance problems. This is a serious issue, and I think it is the most important point. On Mac and Linux, it would be easy to just download the packages themselves and then symlinking them into work, instead of altering the vocab roots. I am not sure if anything like that can be done on Windows, though (I haven't used Windows for 8 years now - maybe they finally have symlinks?) * So for example, to install your monoid package, I run: $ git clone https://github.com/andreaferretti/factor-monoid $ cp -r factor-monoid/monoid /opt/factor64/lib/factor/extra (Thats where my resources:extra is) And in the listener: IN: scratchpad USE: monoid IN: scratchpad 3 3 |+| . 6 No need to restart Factor or any other setup to get it going. Suppose then you released a new version of monoid, I would copy it to /opt/factor64/lib/factor/extra and then simply run: IN: scratchpad refresh-all Loading resource:extra/monoid/monoid.factor Factor would then recompile your monoid vocab and not only
Re: [Factor-talk] A stub of a package manager
Hi Björn, great points! Let me try to comment on them. 2014-12-19 5:14 GMT+01:00 Björn Lindqvist bjou...@gmail.com: Great work Andrea! Factor needs a package management system eventually. Programmers have this strange infatuation with packages and unless the language offers it, it's just not taken seriously. Maybe because people are customed to the language core being almost closed and the bar uber high for contributions so people feel they need to release their own packages to contribute. I think Factor's community is more open than that and John and Doug are amazingly responsive on the bug tracker. So if you have any worthwhile code to contribute, just make a pull request and it will be merged quickly. Then you'll get code maintenance for free in case the language changes and your test suite is setup to run nightly which catches bugs. I am sure that John and Doug are doing a fantastic work! The use case I imagined a package manager would be useful, though, is slightly different. First, in a typical corporate setting, there may be a need to mantain different versions of a library at a time. Upgrading all clients of the library may not be feasible because of manpower. It often happens that Mr. A writes a first version of a library acme-lib which is used by Mr B to write acme-webapp,. Then Mr. A releases a much improved version of acme-lib, and everyone at acme uses it, but unfortunately the API has changed a lot. acme-webapp is now in manteinance mode, and Mr. B just left to found his own startup. There should be a way to keep working on acme-webapp - say to fix vulnerabilities - without requiring a complex refactoring just to move to the new version of acme-lib. In other words, there should be two co-existent versions of acme-lib, and clients should be free to decide which one to use and upgrade at their own pace. Second, and possibly more important, versions do exist externally. For instance, I was thinking about writing a library to talk with the Kafka messaging system. The binary protocol of Kafka has changed between versions 0.7 and 0.8. If I had implemented a Kafka library for Factor before 0.8 came out, I may now have the need to upgrade it to support 0.8, without losing the possibility to connect to 0.7 clusters. So I tried to get your package manager to work, but something goes wrong: USE: packages.example example-project activate Added packages.projects vocabulary to search path More than one file found for vocabulary: example-project Type :help for debugging help. If you are using the version in https://github.com/andreaferretti/factor-packages - which I left unchanged so that people can try it without issues, it should be USE: packages.projects packages.example activate There may be an issue with the error message, but error reporting is just not there yet. Let me know if it works for you Maybe the code is in flux? Anyway, here are some random thoughts about your implementation: * You can't have one voacb root per package. If you run threads. in the listener, you'll see that there is one thread for each of the three roots. They monitor that directory tree and reloads vocabs that change automatically. See http://docs.factorcode.org/content/article-vocabs.refresh.html So yes, there are performance problems. This is a serious issue, and I think it is the most important point. On Mac and Linux, it would be easy to just download the packages themselves and then symlinking them into work, instead of altering the vocab roots. I am not sure if anything like that can be done on Windows, though (I haven't used Windows for 8 years now - maybe they finally have symlinks?) * So for example, to install your monoid package, I run: $ git clone https://github.com/andreaferretti/factor-monoid $ cp -r factor-monoid/monoid /opt/factor64/lib/factor/extra (Thats where my resources:extra is) And in the listener: IN: scratchpad USE: monoid IN: scratchpad 3 3 |+| . 6 No need to restart Factor or any other setup to get it going. Suppose then you released a new version of monoid, I would copy it to /opt/factor64/lib/factor/extra and then simply run: IN: scratchpad refresh-all Loading resource:extra/monoid/monoid.factor Factor would then recompile your monoid vocab and not only that, all vocabs I have loaded that uses monoid would automatically be recompiled too. Uninstallation is a sore point though and that's where I think a package managerwould really shine. This works just because monoid exists in a single version and does not have any dependency. Otherwise, you would have to download all the dependencies too, and make sure to use versions that work well together. Moreover, this is not easily reproducible. Say you do something that uses monoid and you want to pass it to a coworker: you will have to instruct them to follow the same steps. There is no single point in
Re: [Factor-talk] A stub of a package manager
I added basic support for publishing. You can find the updated version [here](https://github.com/andreaferretti/factor-package-manager) (I am not calling it factor-package-manager to mean that it is official in any way, I am just running out of repository names) In fact, it published itself! :-) This version is slightly changed from the old one, but the basics are the same. I think now I will let it rest until some more experienced factorers (is this the right word?) decide if it can have any use. 2014-12-17 20:15 GMT+01:00 Andrea Ferretti ferrettiand...@gmail.com: I thought to use factor itself, as most package managers I have seen use an internal dsl for configuration (sbt, lein, bundler, metacello). Npm uses json, which is both a separate language and valid js. The only exception I know is maven. Of course, using yaml would be fine for me as well. Another possibility would be to avoid the syntax words and write configs with normal words. In fact this works right now, but the required words are currently private. Il giorno 17/dic/2014 19:41, Jon Harper jon.harpe...@gmail.com ha scritto: Is a DSL better than a standard configuration data format ? For example, I worked on yaml serialization/deserialization (http://docs.factorcode.org/content/article-yaml.html) because jckarter was using it in https://gist.github.com/jckarter/3440892 so now this is available. Jon Jon On Wed, Dec 17, 2014 at 7:13 PM, mr wzrd wzr...@gmail.com wrote: On 12/17/2014 09:20 AM, Andrea Ferretti wrote: Hi, following this [small discussion](https://news.ycombinator.com/item?id=8750720) I thought I might give a try at designing a simple package manager. Neat idea. One of the benefits to the one big tree that we have right now is that we guarantee to update your code as the standard library changes or improves. Regardless of whether a package manager is necessary or proper at the moment, it demonstrates that the complex trappings of modern software can be implemented in our simple stack-based-language. - mrw -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Changing global variables at parse time
Wow, that's more than I dared to ask! :-) 2014-12-17 2:35 GMT+01:00 tgkuo tgk...@gmail.com: Quotations are just squeneces -- That's the key point that I not got yet... So, if I wante to put quotation inside a sequence, I would use: IN: scratchpad { 1 2 } [ 3 ] 1quotation append . { 1 2 [ 3 ] } test passed. Thanks. kuo 於 2014/12/17 上午8:55, John Benediktsson 提到: You can see what code is generated for both approaches: SYNTAX: FOO: scan-token '[ _ foo set ] append! ; IN: scratchpad [ FOO: hello ] . [ hello foo set ] SYNTAX: FOO1: scan-token '[ _ foo set ] suffix! \ call suffix! ; IN: scratchpad [ FOO1: hello ] . [ [ hello foo set ] call ] The first is simpler, although the results should be the same as your version. And quotations are just sequences, see this: IN: scratchpad [ 1 2 3 ] first . 1 IN: scratchpad [ 1 2 ] { 3 } append . [ 1 2 3 ] IN: scratchpad { 1 2 } [ 3 ] append . { 1 2 3 } Knowing that, you could also do this, which looks a little weird but works: SYNTAX: FOO2: scan-token suffix! { foo set } append! ; IN: scratchpad [ FOO2: hello ] . [ hello foo set ] On Tue, Dec 16, 2014 at 4:17 PM, tgkuo tgk...@gmail.com wrote: Hi, About the parsing using append! as below SYNTAX: FOO: scan-token '[ _ foo set ] append! ; seemed to have the same effect as this one, which is more understandable SYNTAX: FOO1: scan-token '[ _ foo set ] suffix! \ call suffix! ; As I knew, append! has the stack effect of ( seq seq -- seq ) but the quotation is not a kind of seq, how this works? BR kuo 於 2014/12/17 上午1:00, John Benediktsson 提到: If you want your code to work the way you intend, using a local namespace, then how about this: SYNTAX: FOO: scan-token '[ _ foo set ] append! ; That will set in the namespace that you want. On Tue, Dec 16, 2014 at 8:59 AM, John Benediktsson mrj...@gmail.com wrote: Also, I'm not sure why you need a parsing word for that, you can just: IN: foo SYMBOL: foo IN: bar foo [ hello ] initialize ... or hello foo set-global the first will initialize if not ``f``, the second will always set. On Tue, Dec 16, 2014 at 8:55 AM, Andrea Ferretti ferrettiand...@gmail.com wrote: Hi, I am trying to define some syntax words that should have effect on a global (or dynamic) variable. What I am trying to achieve is something similar to how the LIBRARY: word affects later occurrences of FUNCTION: The problem is, it does not seem to work. The simplest example I can make is up the following. In package foo USING: kernel lexer namespaces ; IN: foo SYMBOL: foo SYNTAX: FOO: scan-token foo set ; Then in package bar USING: namespaces foo prettyprint ; IN: bar FOO: hello foo get . This executes the top level form `foo get .` but prints f instead of hello. The same happens if I use run-file directly. If, instead, I make the same declaration FOO: hello in the listener, I can check that foo is modified. Is there a way to make this work? I could also avoi the variable, but while parsing I do not have access to the stack, and so I do not know how to pass any information among parsing words. -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk
[Factor-talk] A stub of a package manager
Hi, following this [small discussion](https://news.ycombinator.com/item?id=8750720) I thought I might give a try at designing a simple package manager. It is inspired by [Metacello](https://code.google.com/p/metacello/) but delegates to existing source control management software such as git the actual handling of repositories, similar to [Bower](http://bower.io/). You can find the stub of a package manager [here](https://github.com/andreaferretti/factor-packages) (keep in mind: this is just the work of a day, and I am still a beginner). Outline --- The central concept is that of a *project*. A project has a name and a version, and contains some vocabularies. It can also depend on other projects. There are syntax words to define the structure of a project, which currently look like this (for a hypothetical project): USING: packages.syntax IN: example-project PROJECT: example VERSION: 0.2.0-alpha VOCAB: example.thrift VOCAB: example.main DEPENDENCY: thrift GITHUB{ factor thrift 0.2.5 } One can then do the following in the listener IN: scratchpad USE: packages.projects example-project activate This clones the repository for each of the dependencies in a subfolder of resource:cache and switches to the given version. It is expected that each dependency contains a toplevel file `project.factor` as above. Then, transitive dependencies are recursively fetched. After fetching all dependencies, the vocabulary roots are adjusted, and finally all vocabularies mentioned in the project or in a dependency are `require`d. If you import the package manager in your work folder, you can see a [simple example](https://github.com/andreaferretti/factor-packages/blob/master/packages/example/example.factor) in action. Just do IN: scratchpad USE: packages.projects packages.example activate You will then be able to use, say, the `monoid` dependency, like this IN: scratchpad 3 5 |+| I would like to get feedback on the above design, so as to understand if it is worth the effort to develop this into something actually usable. While very simplistic, I think this approach has a couple of advantages: * it does not require any change to the Factor vocabulary system * by exploiting existing SCM (git and hg are currently supported, but it would be easy to add more) one can avoid the need to setup a repository and to develop a custom protocol. Issues -- If the above looks any good, there are a number of things one can improve. All of those seem easy enough, they just requires some time. * support other SCM (svn, darcs, bazaar, ...) * improve the DSL (for instance, should we have VOCABS: ?) * add support for publishing, as well as consuming packages. This would allow to do something like `mypackage publish` and - copy the vocabularies in the cache under the appropriate subfolder - copy the definition file as project.factor - commit the result - tag with the declared version - possibly sync it with online repositories * add error reporting * add standard stuff: tests, docs... * general cleanup and refactoring * GUI tools to support the workflows There are also some issues one may want to consider: * Are there any performance problems in supporting a possibly large set of vocab-roots? (I think not, I see there is a cache for this) * What about the files `project.factor`? Currently they do not follow the standard conventions about file placement. Should I change the directory structure to put them in valid places? * In every package manager there is the issue of transitive dependencies that are included multiple times with different versions. As of now, the result of the above algorithm is that the last version mentioned wins. What could be a better policy? One issue here is that other package managers - Maven, for instance - fetch the specification (in the form of pom.xml) separately from the artifact itself. This allows them to have the complete picture *before* starting to download dependencies, hence apply any policy they choose. The way I have handled it, project.factor files coexist in the same repository as the vocabularies themselves, which complicates things a bit (I have to checkout the repositories to even look at dependencies, but later I may change idea about which versions to use). * If a package manager was used, what would be the impact on the Factor ecosystem? After all, the current model of putting everything in the main repository has some advantages: - it is easier to discover libraries - we avoid redundancy, which at this scale is important (no need for anyone to make another json library, as it is already there) Both points could be partially mitigated having a set of officially endorsed packages, which are one click away in the listener. On the other hand, it will not be feasible forever to have everything in the main repository, and in particular this presents issues when developing libraries which are tied
Re: [Factor-talk] A stub of a package manager
By the way, there are some cleanups under https://github.com/andreaferretti/factor-work But still, I am leaving https://github.com/andreaferretti/factor-packages untouched, so that it works as described in the previous email, in case someone wants to try it. Moreover, notice that https://github.com/andreaferretti/factor-work also contains the two vocabularies that are fetched in the example, so cloning factor-work and then trying the example will not work as expected. 2014-12-17 17:57 GMT+01:00 Alex Vondrak ajvond...@gmail.com: Excited to see where this goes! I like the DSL - reminds me of how it feels to use [Bundler](http://bundler.io/), where the language for dependency management is the same as the language you're coding in. (Can you tell my day job is in Ruby?) I don't really have anything to add - I can't seem to find the time to touch Factor these days, and I shy away from the Big Decisions when it comes to package management (I understand it's a deceptively subtle problem). But I enjoyed reading about your work, and wanted you to know. :) On Wed, Dec 17, 2014 at 8:28 AM, John Benediktsson mrj...@gmail.com wrote: Hi Andrea, I want to look through this and give you a more full response, looks like a pretty good start. Thank you! One of the benefits to the one big tree that we have right now is that we guarantee to update your code as the standard library changes or improves. This prevents bitrot and allows for some flexibility in changing common words. That matters less over time as the standard library becomes more mature, but has been useful at times. We've wanted ``extra/`` to be very very easy to contribute to as a way of supporting new contributors and then involving them as we keep an eye on their code. Obviously there are drawbacks to this approach too... Of course people can have their own repositories, and we should support them as best we can (like support for adding vocab roots or through a package manager), but I always want to encourage contributions when it makes sense for everyone. Having something simple that encourages re-use of code is pretty great, we could probably share our testing infrastructure to support easy continuous integration for a project developed this way. More to come later when I have time. Best, John. On Wed, Dec 17, 2014 at 6:20 AM, Andrea Ferretti ferrettiand...@gmail.com wrote: Hi, following this [small discussion](https://news.ycombinator.com/item?id=8750720) I thought I might give a try at designing a simple package manager. It is inspired by [Metacello](https://code.google.com/p/metacello/) but delegates to existing source control management software such as git the actual handling of repositories, similar to [Bower](http://bower.io/). You can find the stub of a package manager [here](https://github.com/andreaferretti/factor-packages) (keep in mind: this is just the work of a day, and I am still a beginner). Outline --- The central concept is that of a *project*. A project has a name and a version, and contains some vocabularies. It can also depend on other projects. There are syntax words to define the structure of a project, which currently look like this (for a hypothetical project): USING: packages.syntax IN: example-project PROJECT: example VERSION: 0.2.0-alpha VOCAB: example.thrift VOCAB: example.main DEPENDENCY: thrift GITHUB{ factor thrift 0.2.5 } One can then do the following in the listener IN: scratchpad USE: packages.projects example-project activate This clones the repository for each of the dependencies in a subfolder of resource:cache and switches to the given version. It is expected that each dependency contains a toplevel file `project.factor` as above. Then, transitive dependencies are recursively fetched. After fetching all dependencies, the vocabulary roots are adjusted, and finally all vocabularies mentioned in the project or in a dependency are `require`d. If you import the package manager in your work folder, you can see a [simple example](https://github.com/andreaferretti/factor-packages/blob/master/packages/example/example.factor) in action. Just do IN: scratchpad USE: packages.projects packages.example activate You will then be able to use, say, the `monoid` dependency, like this IN: scratchpad 3 5 |+| I would like to get feedback on the above design, so as to understand if it is worth the effort to develop this into something actually usable. While very simplistic, I think this approach has a couple of advantages: * it does not require any change to the Factor vocabulary system * by exploiting existing SCM (git and hg are currently supported, but it would be easy to add more) one can avoid the need to setup a repository and to develop a custom protocol. Issues -- If the above looks any good, there are a number of things one can
Re: [Factor-talk] A stub of a package manager
I thought to use factor itself, as most package managers I have seen use an internal dsl for configuration (sbt, lein, bundler, metacello). Npm uses json, which is both a separate language and valid js. The only exception I know is maven. Of course, using yaml would be fine for me as well. Another possibility would be to avoid the syntax words and write configs with normal words. In fact this works right now, but the required words are currently private. Il giorno 17/dic/2014 19:41, Jon Harper jon.harpe...@gmail.com ha scritto: Is a DSL better than a standard configuration data format ? For example, I worked on yaml serialization/deserialization ( http://docs.factorcode.org/content/article-yaml.html) because jckarter was using it in https://gist.github.com/jckarter/3440892 so now this is available. Jon Jon On Wed, Dec 17, 2014 at 7:13 PM, mr wzrd wzr...@gmail.com wrote: On 12/17/2014 09:20 AM, Andrea Ferretti wrote: Hi, following this [small discussion](https://news.ycombinator.com/item?id=8750720) I thought I might give a try at designing a simple package manager. Neat idea. One of the benefits to the one big tree that we have right now is that we guarantee to update your code as the standard library changes or improves. Regardless of whether a package manager is necessary or proper at the moment, it demonstrates that the complex trappings of modern software can be implemented in our simple stack-based-language. - mrw -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Changing global variables at parse time
Hi, I am trying to define some syntax words that should have effect on a global (or dynamic) variable. What I am trying to achieve is something similar to how the LIBRARY: word affects later occurrences of FUNCTION: The problem is, it does not seem to work. The simplest example I can make is up the following. In package foo USING: kernel lexer namespaces ; IN: foo SYMBOL: foo SYNTAX: FOO: scan-token foo set ; Then in package bar USING: namespaces foo prettyprint ; IN: bar FOO: hello foo get . This executes the top level form `foo get .` but prints f instead of hello. The same happens if I use run-file directly. If, instead, I make the same declaration FOO: hello in the listener, I can check that foo is modified. Is there a way to make this work? I could also avoi the variable, but while parsing I do not have access to the stack, and so I do not know how to pass any information among parsing words. -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Changing global variables at parse time
Oh, thank you, it was more trivial than I had realized! 2014-12-16 17:57 GMT+01:00 Doug Coleman doug.cole...@gmail.com: You can call set-global and get-global instead of set and get. The words are executing in the dynamic scope of the parser and the values getting lost when parsing returns. Doug On Tue, Dec 16, 2014 at 8:55 AM, Andrea Ferretti ferrettiand...@gmail.com wrote: Hi, I am trying to define some syntax words that should have effect on a global (or dynamic) variable. What I am trying to achieve is something similar to how the LIBRARY: word affects later occurrences of FUNCTION: The problem is, it does not seem to work. The simplest example I can make is up the following. In package foo USING: kernel lexer namespaces ; IN: foo SYMBOL: foo SYNTAX: FOO: scan-token foo set ; Then in package bar USING: namespaces foo prettyprint ; IN: bar FOO: hello foo get . This executes the top level form `foo get .` but prints f instead of hello. The same happens if I use run-file directly. If, instead, I make the same declaration FOO: hello in the listener, I can check that foo is modified. Is there a way to make this work? I could also avoi the variable, but while parsing I do not have access to the stack, and so I do not know how to pass any information among parsing words. -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Changing global variables at parse time
Yes, I know, this was just a minimal example 2014-12-16 17:59 GMT+01:00 John Benediktsson mrj...@gmail.com: Also, I'm not sure why you need a parsing word for that, you can just: IN: foo SYMBOL: foo IN: bar foo [ hello ] initialize ... or hello foo set-global the first will initialize if not ``f``, the second will always set. On Tue, Dec 16, 2014 at 8:55 AM, Andrea Ferretti ferrettiand...@gmail.com wrote: Hi, I am trying to define some syntax words that should have effect on a global (or dynamic) variable. What I am trying to achieve is something similar to how the LIBRARY: word affects later occurrences of FUNCTION: The problem is, it does not seem to work. The simplest example I can make is up the following. In package foo USING: kernel lexer namespaces ; IN: foo SYMBOL: foo SYNTAX: FOO: scan-token foo set ; Then in package bar USING: namespaces foo prettyprint ; IN: bar FOO: hello foo get . This executes the top level form `foo get .` but prints f instead of hello. The same happens if I use run-file directly. If, instead, I make the same declaration FOO: hello in the listener, I can check that foo is modified. Is there a way to make this work? I could also avoi the variable, but while parsing I do not have access to the stack, and so I do not know how to pass any information among parsing words. -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Deploying application
The `reader-word` word does indeed use reflection to set word properties dynamically, see here http://docs.factorcode.org/content/word-reader-word,slots.html If I understand correctly, I think you could simply replace the list { deb:name deb:version deb:priority deb:section deb:maintainer deb:filename deb:md5sum deb:description deb:homepage deb:depends deb:pre-depends deb:suggests deb:conflicts deb:recommends deb:breaks deb:replaces deb:provides deb:provided-by deb:tags deb:enhances } which you are trying to map into actual accessors with the list of accessors itself, like { [ name ] [ version ] ... } It should be as concise and avoid reflection 2014-12-11 12:08 GMT+01:00 Roberto López roberto.lo...@acm.org: Hi John, I've just shared a reduced version of my code. No PEG, no sense but it doesn't need any input data. http://paste.factorcode.org/paste?id=3410 I've detected the die word is called when reading-word is executed. I hope it helps. Regards, Roberto. John Benediktsson mrj...@gmail.com writes: Hi Robert, It's unlikely this is due to PEGs, for example this example I just now made from an old blog post works using Level 1 and deploy as console application: http://paste.factorcode.org/paste?id=3408 It is more likely that you are trying to use a feature like prettyprint (used by the . word) or something else that requires a higher level of reflection about the system. In factor, my first example used . instead of numberstring print and had a very similar error at Level 1 as yours. If you'd like to share some of your code either in public or in private, I could help you figure it out? We should spend some more time with deploy, it hasn't gotten as much love as other parts of the system and so might feel a little fragile or magical sometimes. Best, John. On Wed, Dec 10, 2014 at 1:55 AM, Roberto López roberto.lo...@acm.org wrote: Hi, I am trying to deploy a console application using the awesome PEG vocabulary. If I choose to deploy using Level 1 - No reflection the application fails when I run it with. The message is... | The die word was called by the library. Unless you called it yourself, | you have triggered a bug in Factor. Please report. | Starting low level debugger... | Basic commands: | q ^D -- quit Factor | c-- continue executing Factor - NOT SAFE | t-- throw exception in Factor - NOT SAFE | .s .r .c -- print data, retain, call stacks | help -- full help, including advanced commands | | DATA STACK: | T{ #not a string: f accessors:name } | T{ #not a string: f accessors:name } | RETAIN STACK: | CALL STACK: | | frame: 0x7f41b94b5f38 size 32 | executing: f | scan: f | word/quot addr: 1 | word/quot xt: 7f419e5a3500 | return address: 7f419e5a3531 | | frame: 0x7f41b94b5f58 size 32 | executing: [ #not a string: f 1 #not a string: f ] | scan: 0 | word/quot addr: 7f41a2aaec64 | word/quot xt: 7f419e7312e0 | return address: 7f419e7312ef | | frame: 0x7f41b94b5f78 size 16 | executing: f | scan: f | word/quot addr: 1 | word/quot xt: 7f419e69fb60 | return address: 7f419e69fb80 | | frame: 0x7f41b94b5f88 size 16 | executing: f | scan: f | word/quot addr: 1 | word/quot xt: 7f419e723dc0 | return address: 7f419e723df1 | | frame: 0x7f41b94b5f98 size 32 | executing: [ #not a string: f T{ #not a string: f 0 0 { T{ #not a string: f f } T{ #not a string: f f } T{ #not a string: f f } T{ #not a string: f f } T{ #not a string: f f } T{ #not a string: f f } T{ #not a string: f f } T{ #not a string: f f } } } #not a string: f #not a string: f #not a string: f T{ #not a string: f 0 0 { T{ #not a string: f f } T{ #not a string: f f } T{ #not a string: f f } T{ #not a string: f f } } } #not a string: f #not a string: f #not a string: f T{ #not a string: f { } 0 }... ] | scan: 58 | word/quot addr: 7f41a2b95814 | word/quot xt: 7f419e72e800 | return address: 7f419e72e9c1 | | frame: 0x7f41b94b5fb8 size 32 | executing: f | scan: f | word/quot addr: 1 | word/quot xt: 7f419e549060 | return address: 7f419e549084 But If I choose to deploy using Level 6 - Full environment the application runs correctly. No problem with this level but the executable is too big. Any idea to get a smaller executable? -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Quotations and generics
Hi, I am trying to implement monoids in factor. A monoid is a set with a binary associative operation (and, depending on the defintiion, a neutral element for it). Typical examples are numbers (with either addition or multiplication) or sequences (with concatenation). Other examples can be derived from these, since hastables whose values are in a monoid are also naturally a monoid. My implementation is here https://github.com/andreaferretti/factor-work/blob/master/monoid/monoid.factor Using |+| as the word for the operation, one has for instance 3 5 |+| ! gives 8 hello world |+| ! gives hello world H{ { 1 2 } { 3 4 } } H{ { 1 5 } { 5 6 } } |+| ! gives H{ { 1 7 } { 3 4 } { 5 6 } } The issue I have is with quotations. Functions with values in a monoid are also naturally a monoid - in order to sum two functions, apply both and sum the values. So I have the definition M: quotation |+| [ bi |+| ] 2curry ; The problem is that this only works for functions of one argument. For functions of 2 arguments one would have to use M: quotation |+| [ 2bi |+| ] 2curry ; and so on. Unfortunately, there is only a class quotation, which does not seem to distinguish the arity. For comparison, in scala functions have different types based on the arity (such a Function2[A1, A2, B]), and this allows to correctly define |+| - in fact it is a common method in scalaz. Is there anything I can do to make this work regardless of function arity? Also, what about dispatching on both arguments, so that the method only makes sense for a pair of numbers or a pair of quotations, but, say 3 hi |+| fails to dispatch? -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Quotations and generics
Wow, you and Factor never stop to surprise me! :-) 2014-12-05 16:23 GMT+01:00 John Benediktsson mrj...@gmail.com: And more generally, using the ``generalizations`` vocabulary: M: quotation |+| dup infer in length [ nbi |+| ] 3curry ; On Fri, Dec 5, 2014 at 7:22 AM, John Benediktsson mrj...@gmail.com wrote: You could use the stack-checker to infer the effect of the quotation and then dispatch like this: ``` M: quotation |+| dup infer in length { { 1 [ [ bi |+| ] 2curry ] } { 2 [ [ 2bi |+| ] 2curry ] } { 3 [ [ 3bi |+| ] 2curry ] } } case ; ``` But you might start running into places where the compiler is trying to dispatch on the run-time value of a quotation, and you would need to add a ``call( x y -- z )`` with static stack effects to tell it what to expect. We have multiple dispatch implemented in the ``multi-methods`` vocabulary, so you could do something like this: http://re-factor.blogspot.com/2013/10/rock-paper-scissors.html On Fri, Dec 5, 2014 at 2:10 AM, Andrea Ferretti ferrettiand...@gmail.com wrote: Hi, I am trying to implement monoids in factor. A monoid is a set with a binary associative operation (and, depending on the defintiion, a neutral element for it). Typical examples are numbers (with either addition or multiplication) or sequences (with concatenation). Other examples can be derived from these, since hastables whose values are in a monoid are also naturally a monoid. My implementation is here https://github.com/andreaferretti/factor-work/blob/master/monoid/monoid.factor Using |+| as the word for the operation, one has for instance 3 5 |+| ! gives 8 hello world |+| ! gives hello world H{ { 1 2 } { 3 4 } } H{ { 1 5 } { 5 6 } } |+| ! gives H{ { 1 7 } { 3 4 } { 5 6 } } The issue I have is with quotations. Functions with values in a monoid are also naturally a monoid - in order to sum two functions, apply both and sum the values. So I have the definition M: quotation |+| [ bi |+| ] 2curry ; The problem is that this only works for functions of one argument. For functions of 2 arguments one would have to use M: quotation |+| [ 2bi |+| ] 2curry ; and so on. Unfortunately, there is only a class quotation, which does not seem to distinguish the arity. For comparison, in scala functions have different types based on the arity (such a Function2[A1, A2, B]), and this allows to correctly define |+| - in fact it is a common method in scalaz. Is there anything I can do to make this work regardless of function arity? Also, what about dispatching on both arguments, so that the method only makes sense for a pair of numbers or a pair of quotations, but, say 3 hi |+| fails to dispatch? -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Quotations and generics
Ehr... in fact, I was not :-P In fact, the implementation of |+| that comes from this is composition, which is of course another natural operation. I did not hitnk of it 2014-12-05 18:55 GMT+01:00 Björn Lindqvist bjou...@gmail.com: I wonder, are you aware that quotations are just a type of sequence? So: [ * ] [ numberstring print ] append [ 3 9 ] dip call Does what you would expect. :) You can even add stack effects and the algebra will work out: ( x -- ) ( x x x -- x x ) compose-effects 2014-12-05 11:10 GMT+01:00 Andrea Ferretti ferrettiand...@gmail.com: Hi, I am trying to implement monoids in factor. A monoid is a set with a binary associative operation (and, depending on the defintiion, a neutral element for it). Typical examples are numbers (with either addition or multiplication) or sequences (with concatenation). Other examples can be derived from these, since hastables whose values are in a monoid are also naturally a monoid. My implementation is here https://github.com/andreaferretti/factor-work/blob/master/monoid/monoid.factor -- mvh/best regards Björn Lindqvist -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Output parameters in alien
Thank you, it seems that all I need is to use { char n } instead of c-string. Since it is an output parameter anyway, I don't care about how memory is allocated anyway, only that it is big enough. Just to be sure: with-out-parameters takes care of freeing the underlying alien, right? For instance, say in Jon's example I did : foo ( -- ) { { char 2000 } } [ B strcpy drop ] with-out-parameters utf8 alienstring print ; After the strcpy, the third byte of the allocated memory will be null, and alienstring correctly cuts the string there. In doing this, I think I am not creating any leaks, but I would like to have confirmation from more experienced users 2014-11-29 19:46 GMT+01:00 Andrea Ferretti ferrettiand...@gmail.com: Thank you! I am away now, but I will try all of your solutions on monday! :-) 2014-11-28 22:30 GMT+01:00 Jon Harper jon.harpe...@gmail.com: After investigating a bit, it might be possible? If someone more knowledgeable about the ffi could comment on the following: FUNCTION: char* strcpy ( char * , c-string ) ; : foo ( -- ) { { { char 2 } initial: B{ 0x41 0 } } } [ B strcpy drop ] with-out-parameters utf8 alienstring print ; : bar ( -- ) { { { char 2 } initial: B{ 0x41 0 } } } [ drop ] with-out-parameters utf8 alienstring print ; foo ! prints B bar ! prints A If there is no syntactic sugar yet for passing strings with with-out-parameters, it might be interesting to add it I guess PS: typed this manually, sorry if there are typos :) Jon Le 28 nov. 2014 20:43, Jon Harper jon.harpe...@gmail.com a écrit : John provided an alternative, but here are the explanations of the errors you got: On Fri, Nov 28, 2014 at 5:14 PM, Andrea Ferretti ferrettiand...@gmail.com wrote: { { c-string } } [ hello world swap example_cp ] with-out-parameters The syntax of with-out-parameters is an array of elements, which are either a c-type, or a triple { c-type intial: value }. So in your case, it should have been { c-string } [ hello world swap example_cp ] with-out-parameters I get index out of bounds: 0 which seems reasonable, since I pass an empty c-string. But if I try something like { { c-string initial: hello earth } } [ hello world swap example_cp ] with-out-parameters I get local-allocation-error. The FFI only works with the optimizing compiler, so this code should be defined in a word, not run in the interactive listener. You can define the word in a source file, or directly in the listener and then call it just after you defined it Cheers, Jon -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Factor packaging for Ubuntu
Great, thanks! Il giorno 29/nov/2014 10:38, Björn Lindqvist bjou...@gmail.com ha scritto: Yes! Now there's a Utopic package there too. 2014-11-26 12:00 GMT+01:00 Andrea Ferretti ferrettiand...@gmail.com: Would it be possible to add a package for Ubuntu 14.10? 2014-11-25 19:39 GMT+01:00 John Porubek jporu...@gmail.com: On Sat, Nov 22, 2014 at 11:35 AM, Björn Lindqvist bjou...@gmail.com wrote: I have just now created new packages for Ubuntu trusty and precise, based on the git version, which you can download from the same place as below. It's not a release version, but it works well enough for me. Just remember that you need to type factor-lang to run factor. This just showed up in Update Manager on my Ubuntu 12.04 LTS system and installed without a hitch. I especially appreciate that it shows the version info. in both the gui and console invocations. Thanks Björn for your efforts in creating this. -John -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- mvh/best regards Björn Lindqvist -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Output parameters in alien
Thank you! I am away now, but I will try all of your solutions on monday! :-) 2014-11-28 22:30 GMT+01:00 Jon Harper jon.harpe...@gmail.com: After investigating a bit, it might be possible? If someone more knowledgeable about the ffi could comment on the following: FUNCTION: char* strcpy ( char * , c-string ) ; : foo ( -- ) { { { char 2 } initial: B{ 0x41 0 } } } [ B strcpy drop ] with-out-parameters utf8 alienstring print ; : bar ( -- ) { { { char 2 } initial: B{ 0x41 0 } } } [ drop ] with-out-parameters utf8 alienstring print ; foo ! prints B bar ! prints A If there is no syntactic sugar yet for passing strings with with-out-parameters, it might be interesting to add it I guess PS: typed this manually, sorry if there are typos :) Jon Le 28 nov. 2014 20:43, Jon Harper jon.harpe...@gmail.com a écrit : John provided an alternative, but here are the explanations of the errors you got: On Fri, Nov 28, 2014 at 5:14 PM, Andrea Ferretti ferrettiand...@gmail.com wrote: { { c-string } } [ hello world swap example_cp ] with-out-parameters The syntax of with-out-parameters is an array of elements, which are either a c-type, or a triple { c-type intial: value }. So in your case, it should have been { c-string } [ hello world swap example_cp ] with-out-parameters I get index out of bounds: 0 which seems reasonable, since I pass an empty c-string. But if I try something like { { c-string initial: hello earth } } [ hello world swap example_cp ] with-out-parameters I get local-allocation-error. The FFI only works with the optimizing compiler, so this code should be defined in a word, not run in the interactive listener. You can define the word in a source file, or directly in the listener and then call it just after you defined it Cheers, Jon -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Output parameters in alien
I am trying to interface with C code. Everything seems to work more or less fine, until I have to deal with output parameters, that is, parameters in C functions which are meant to be passed buffers which are filled by the function. I have made a very basic example which only copies a string and I have made a shared library called libexample.so which exports void example_cp(char *in, char *out); I have verified that I can call the shared library from C. Now in factor I have defined an interface like this USING: alien alien.c-types alien.syntax alien.libraries ; IN: example-alien libexample /home/papillon/esperimenti/ssl/libexample.so cdecl add-library LIBRARY: libexample FUNCTION: void example_cp ( c-string in, c-string out ) ; In the listener I try to use example_cp, but I am not sure how to pass a preallocated char buffer. If I try { { c-string } } [ hello world swap example_cp ] with-out-parameters I get index out of bounds: 0 which seems reasonable, since I pass an empty c-string. But if I try something like { { c-string initial: hello earth } } [ hello world swap example_cp ] with-out-parameters I get local-allocation-error. What is the correct way to pass a preallocated buffer? -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Factor tutorial
Thank you for the suggestions! I have started incorporating some, more to come in the next days :-) 2014-11-22 16:58 GMT+01:00 John Benediktsson mrj...@gmail.com: Hi Andrea, Wow, great contribution!! Some comments: You might avoid naming your factorial word ! or at least make a small comment to your readers that it shadows the ! token that is used for comments in the code (preventing its use as comments). IN: scratchpad ! a comment IN: scratchpad : ! ( n -- n ) ; IN: scratchpad ! not a comment! One could argue that we should use a more standard // or # like other languages, but such is some legacy decision somewhere along the way. Might be worth changing at some point. Also in that section, you might mention the breadth of the standard library, your ``prod`` word is defined in the ``sequences`` vocabulary as ``product``. And is possibly more efficient because it uses a binary reduce that for large numbers keeps more of them smaller for longer, resulting in less bignum multiplication. On the syntax section, it might be fun to give an example of using SYNTAX:. I have a few on my blog to help give you some ideas: http://re-factor.blogspot.com/2010/08/fat-arrows.html http://re-factor.blogspot.com/2014/06/swift-ranges.html http://re-factor.blogspot.com/2010/07/rolling-dice.html It's a useful beginner lesson to teach that Factor is tokens that parse and that { isn't just some list literal embedded in the language, but that you can see how it works, change it, or replace it, or build it yourself as an addon. A small exception to that might be number and string literals which right now are built directly into the parser. On the github.tutorial section, I would also suggest mentioning our editor support works for vocabularies, so for example after doing ``scaffold-work``, you might just type: IN: scratchpad github.tutorial edit For new users, this will prompt with a list of editors to choose from (rather than needing to explicitly USE: it like you do in the tutorial). After that point, it will open the file directly in the editor. For words, it opens the file they are defined in (``\ foo where`` if you're curious how that works) and tries in most editors to bring the cursor to the proper line number. You can also use ``vocab edit-tests`` to get to the tests file, ``vocab edit-docs`` to open the documentation file, etc. When you mention ``boa`` constructors, you might also demonstrate that these are equivalent (allowing easy generation of constructor words for the common case): : movie ( title director actors -- movie ) movie boa ; C: movie movie Since Factor parses tokens between one or more whitespace characters, these are equivalent if you prefer the second for readability: TUPLE: band { keyboards string read-only } { guitar string read-only } { bass string read-only } { drums string read-only } ; TUPLE: band { keyboards string read-only } { guitar string read-only } { bass string read-only } { drums string read-only } ; For your later prime example with fry quotations, I'd also provide this example which uses ``with`` to capture the notion of currying something under the stack in this use case: : prime? ( n -- ? ) 2 over sqrt [a,b] [ divisor? ] with any? not ; Your ``safe-head`` word can be captured instead of using exceptions and recover, by just doing ``short head`` which mins with length of sequence (avoiding the exception, unless ``n`` is negative). Good http examples, I'd also point you to this post which shows some use of forms and validation: http://re-factor.blogspot.com/2010/08/hello-web.html Looks like you've put a lot of effort into this and I love it, great job! I'm going to make a post linking to this on my blog! Best, John. On Sat, Nov 22, 2014 at 6:36 AM, Andrea Ferretti ferrettiand...@gmail.com wrote: Hello, I have written a Factor tutorial, which you can find at http://andreaferretti.github.io/factor-tutorial/ (source https://github.com/andreaferretti/factor-tutorial ) Factor has a lot of documentation in the listener, but I have tried to cover some topics that are present in the official docs, but scattered throughout it, so that they were not clear to me at the beginning. These include for instance: - the central concept is function composition, the stack is more of a detail - how simple is to deploy program and scripts - what tools are there: linter, inspector, unit testing support, reverse lookup of function uses... - what model of multithreading and async I/O are used - how to make use of multiple cores - in what sense Factor has an object system and more I was able to answer some of those - especially multithreading - thanks to the help I got on this list. I am sure there are many mistakes - after all, I am still a beginner with Factor - and many things
[Factor-talk] Factor tutorial
Hello, I have written a Factor tutorial, which you can find at http://andreaferretti.github.io/factor-tutorial/ (source https://github.com/andreaferretti/factor-tutorial ) Factor has a lot of documentation in the listener, but I have tried to cover some topics that are present in the official docs, but scattered throughout it, so that they were not clear to me at the beginning. These include for instance: - the central concept is function composition, the stack is more of a detail - how simple is to deploy program and scripts - what tools are there: linter, inspector, unit testing support, reverse lookup of function uses... - what model of multithreading and async I/O are used - how to make use of multiple cores - in what sense Factor has an object system and more I was able to answer some of those - especially multithreading - thanks to the help I got on this list. I am sure there are many mistakes - after all, I am still a beginner with Factor - and many things that can be improved, both in the exposition and in the choice of examples. But I wanted to get it out eventually, even with something to be retouched later. I intend to improve it in the future, and any suggestion is welcome - or even better, you can file pull requests! Best, Andrea -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Multithreading in Factor
I think the missing point for me was node-server. I knew how to start a few server examples, but in general threaded-server requires an encoding and a few parameters for configuration. What was not obvious for me was how to create a server that would work with Factor distributed message passing (for instance I had no idea what encoding to choose because I don't know how serialization is performed). node-server was what I needed. I have a few more doubts: - if I understand correctly, Factor has both an actor model and a CSP implementation, the first one using named thread on processes - so that you can send messages asynchronously provided you know the address of the recipient - and the second one using channels, which are a point of synchronization and decouple sender and receiver. Is this correct? - is it possible to start the second Factor instance from the first one? I guess this is possible using run-detached, but maybe there is something Factor specific. Just to clarify, my end goal would be to be able to launch a few worker processes, say a fixed multiple of the number of available cores, and have a Factor frontend that delegates work to them. Servers are becoming more and more multicore, and it is hard to sell Factor without being able to make good use of them. 2014-11-21 0:05 GMT+01:00 Jon Harper jon.harpe...@gmail.com: Just to confirm that the following sequence of actions work (ie print hello in the first factor instance) $ ./factor # first factor process USING: concurrency.distributed threads io.sockets io.servers ; 127.0.0.1 9000 inet4 node-server start-server FROM: concurrency.messaging = receive ; : log-message ( -- ) receive . flush log-message ; [ log-message ] logger spawn dup name register-remote-thread $ ./factor # second factor process USING: io.sockets concurrency.messaging concurrency.distributed ; FROM: concurrency.messaging = send ; hello 127.0.0.1 9000 inet4 logger remote-thread send Jon Jon On Thu, Nov 20, 2014 at 10:09 PM, Chris Double chris.dou...@double.co.nz wrote: On Thu, Nov 20, 2014 at 8:24 AM, Andrea Ferretti ferrettiand...@gmail.com wrote: I am trying to make this work, but I have issues with the line myhost.com 9001 start-server Looks like the API for starting servers/nodes has changed quite a bit. If you look at the following file you'll see examples of current usage: basis/concurrency/distributed/distributed-tests.factor -- http://bluishcoder.co.nz -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Factor 0.97 now available
I am sorry to be insistent, but are there any news on this? I am trying to show Factor to some colleagues, and it immediately looks bad, needing a workaround just after the download 2014-11-05 18:01 GMT+01:00 Björn Lindqvist bjou...@gmail.com: Yeah that's probably needed. 2014-11-05 16:35 GMT+01:00 John Benediktsson mrj...@gmail.com: Hmm, maybe we should revert back to requiring development libraries for now, and do a 0.97.1 release. On Wed, Nov 5, 2014 at 1:07 AM, Andrea Ferretti ferrettiand...@gmail.com wrote: It works for me too. Any chance this fix will be deployed in the official download? It is unforunate that the default download does not work out of the box on recent Ubuntus, as it may hinder adoption 2014-11-04 19:12 GMT+01:00 mr wzrd wzr...@gmail.com: On 11/04/2014 01:02 PM, Björn Lindqvist wrote: You and mr wzrd, run this in a terminal: $ ./factor -run=listener IN: scratchpad gtk.ffi reload IN: scratchpad save Then Factors GUI should start. I've written an explanation of the bug here: https://github.com/slavapestov/factor/issues/1185 Works. Nice job! - mrw -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- mvh/best regards Björn Lindqvist -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Factor 0.97 now available
Yes, the download from the website fails both on Ubuntu 14.04 and 14.10. 2014-11-20 17:22 GMT+01:00 John Benediktsson mrj...@gmail.com: Did you try the download from the factorcode website? On Nov 20, 2014, at 7:43 AM, Andrea Ferretti ferrettiand...@gmail.com wrote: Yeah, the version on github works on my Ubuntu 14.04. It reports to be Factor 0.98 x86.64 (1539, heads/master-0-g46174ab, Thu Nov 20 16:35:41 2014) 2014-11-20 14:51 GMT+01:00 John Benediktsson mrj...@gmail.com: I believe it it fixed in the development release (could you check?), but we want to make sure before doing a small point release. Right now we are thinking of releasing master vs only backporting that patch. Master has some good changes but we have two small things to fix for linux32 and windows64. Thanks, John. On Nov 20, 2014, at 2:06 AM, Andrea Ferretti ferrettiand...@gmail.com wrote: I am sorry to be insistent, but are there any news on this? I am trying to show Factor to some colleagues, and it immediately looks bad, needing a workaround just after the download 2014-11-05 18:01 GMT+01:00 Björn Lindqvist bjou...@gmail.com: Yeah that's probably needed. 2014-11-05 16:35 GMT+01:00 John Benediktsson mrj...@gmail.com: Hmm, maybe we should revert back to requiring development libraries for now, and do a 0.97.1 release. On Wed, Nov 5, 2014 at 1:07 AM, Andrea Ferretti ferrettiand...@gmail.com wrote: It works for me too. Any chance this fix will be deployed in the official download? It is unforunate that the default download does not work out of the box on recent Ubuntus, as it may hinder adoption 2014-11-04 19:12 GMT+01:00 mr wzrd wzr...@gmail.com: On 11/04/2014 01:02 PM, Björn Lindqvist wrote: You and mr wzrd, run this in a terminal: $ ./factor -run=listener IN: scratchpad gtk.ffi reload IN: scratchpad save Then Factors GUI should start. I've written an explanation of the bug here: https://github.com/slavapestov/factor/issues/1185 Works. Nice job! - mrw -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- mvh/best regards Björn Lindqvist -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Multithreading in Factor
I am trying to make this work, but I have issues with the line myhost.com 9001 start-server in the documentation. start-server takes a threaded server as input, and this just does not run as is. I could try with a threaded server, but I am not sure how to configure it, and what encoding to use. I am also slightly confused about: 1) whether to use remote channels or remote threads to implement messaging 2) whether I can spawn a second Factor instance from Factor itself or if I should rather start it manually Thank you Andrea 2014-10-19 5:12 GMT+02:00, Chris Double chris.dou...@double.co.nz: ZeroMQ has a non-blocking mode. You can get a file descriptor that can be passed to select/epoll/kqueue. Factor has its own channel and serialization system to. See: http://docs.factorcode.org/content/article-remote-channels,remote-channels.html On Sun, Oct 19, 2014 at 4:30 AM, Andrea Ferretti ferrettiand...@gmail.com wrote: Thank you for you response. Regarding the possibility if delegating CPU intensive tasks to multiple tasks: what about communication? Is there an idiomatic way to make processes communicate without blocking? There is ZeroMQ, but as far as I know it is blocking. It would be nice to develop something like Erlang/Akka using a pool of processes and cooperative multithreading locally inside each process, but I am not sure what would be the best way to keep a channel among processes 2014-10-15 14:40 GMT+02:00 Björn Lindqvist bjou...@gmail.com: Hi Andrea, I'm not an expert, so take what's written below with a grain of salt. It mostly comes from what I've snapped up from varius places and reading the mailing list archive (eg http://search.gmane.org/?query=threadinggroup=comp.lang.factor.generalsort=relevance). 2014-10-13 18:14 GMT+02:00 Andrea Ferretti ferrettiand...@gmail.com: Hi, I have read in various places, including this mailing list, that Factor does not currently have support for (preemptive, kernel-level) multithreading, and that adding support for that would require a great deal of changes, since the underlying VM and many core words are not thread-safe. It's true that Factor doesn't have preemptive, kernel-level threading (I'll just write threading from now on when I refer to this particular brand of threading) and that adding it would probably require a lot of engineering and restructuring work. But if you dig into the source, and read the previous discussions, it's clear that adding threading was always the idea and the Factor VM has been architected to make it simple to add in the future. Whether it actually is simple or not, is a different matter. But it's much different from, say, the CPython VM which is implemented in such a way that it would be virtually impossible to add threading. Most composite (non-primitive) words are thread-safe and the primitive words are only thread-unsafe in that critical sections aren't guarded by exclusion locks. Can anyone expand on this? Is there some place where people have collected some ideas about the issues that would arise and the areas that need work? I don't think there is any particularly bloody issues. It's just a lot of hard work. For example interactions between threads and gc can be very tricky. If two threads need to allocate memory, there needs to be some synchronization so that they don't end up pointing to the same chunk of memory. How do you make that both fast and safe? What happens with a threads object references if another thread forces a gc cycle? I guess all threads has to stop running during the gc so that all object references can be updated. It's even more complicated if one thread is in an ffi function which holds a pointer to a Factor object. What if another thread recompiles the same word a thread is running? If not, it would be nice to gather such information from people knowledgeable about the internals of factor, so that interested people could start make some contributions. I don't know if personally I would be able to contribute, but I'd love to if I I found something I could handle An alien wrapper for pthreads would be interesting. I've no idea if it would kind of work or break Factor badly, non-the-less it would be interesting to see. While we're at the subject of threading.. It's a great feature but a language VM can do without it and still be very useful. Python, Erlang, Node.js and Ruby all proves that. If the goal of the concurrency is IO throughput, then cooperative threads which Factor already has works really well. For cpu intensive tasks you can often start multiple processes instead of threading. -- mvh/best regards Björn Lindqvist -- Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http
Re: [Factor-talk] Factor 0.97 now available
It works for me too. Any chance this fix will be deployed in the official download? It is unforunate that the default download does not work out of the box on recent Ubuntus, as it may hinder adoption 2014-11-04 19:12 GMT+01:00 mr wzrd wzr...@gmail.com: On 11/04/2014 01:02 PM, Björn Lindqvist wrote: You and mr wzrd, run this in a terminal: $ ./factor -run=listener IN: scratchpad gtk.ffi reload IN: scratchpad save Then Factors GUI should start. I've written an explanation of the bug here: https://github.com/slavapestov/factor/issues/1185 Works. Nice job! - mrw -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Factor 0.97 now available
Congratulations for the great work! I would be glad to see a 1.0 release, if anything just for psychological reasons when I show Factor to my colleagues :-) Are there any plans to move the distribution to a model with a core + a package manager? I think at this point it would benefit the community if there was an official way to provide new libraries without being involved in the core. Package managers for image-based languages are slightly delicate, but I think the model used by Monticello+Metacello in the Smallatlk community works pretty well. Best, Andrea 2014-11-03 13:27 GMT+01:00 John Benediktsson mrj...@gmail.com: We've been brainstorming a few things. Not sure how much of it will be done and in what order, but some of the features I'd like us to work on: - new parser to allow parsing cross-platform vocabularies without loading them and development of useful refactoring tools - improve compiler for performance of fixnums, loops, and generic dispatch, possibly leveraging LLVM - faster namespace variables (which are used in a lot of places) using a different lookup algorithm - unification of core and basis to allow using higher level language features earlier in the bootstrap process And more vocabularies and libraries, etc. Plus we love contributions so if anyone else has some ideas here, we'd love to hear. Best, John. On Nov 3, 2014, at 3:23 AM, Björn Lindqvist bjou...@gmail.com wrote: Hurra! Any plans for 0.98 or, dare I say it, 1.0? Factor feels like a very solid language to me and it's just lacking in polish. -- mvh/best regards Björn Lindqvist -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Factor 0.97 now available
By the way, I have the same issue as mr wzrd - on Ubuntu 14.04 64bit desktop edition. I *do* have a libgtk-x11-2.0.so.0, but it is under /usr/lib/x86_64-linux-gnu/ 2014-11-04 10:06 GMT+01:00 Andrea Ferretti ferrettiand...@gmail.com: Congratulations for the great work! I would be glad to see a 1.0 release, if anything just for psychological reasons when I show Factor to my colleagues :-) Are there any plans to move the distribution to a model with a core + a package manager? I think at this point it would benefit the community if there was an official way to provide new libraries without being involved in the core. Package managers for image-based languages are slightly delicate, but I think the model used by Monticello+Metacello in the Smallatlk community works pretty well. Best, Andrea 2014-11-03 13:27 GMT+01:00 John Benediktsson mrj...@gmail.com: We've been brainstorming a few things. Not sure how much of it will be done and in what order, but some of the features I'd like us to work on: - new parser to allow parsing cross-platform vocabularies without loading them and development of useful refactoring tools - improve compiler for performance of fixnums, loops, and generic dispatch, possibly leveraging LLVM - faster namespace variables (which are used in a lot of places) using a different lookup algorithm - unification of core and basis to allow using higher level language features earlier in the bootstrap process And more vocabularies and libraries, etc. Plus we love contributions so if anyone else has some ideas here, we'd love to hear. Best, John. On Nov 3, 2014, at 3:23 AM, Björn Lindqvist bjou...@gmail.com wrote: Hurra! Any plans for 0.98 or, dare I say it, 1.0? Factor feels like a very solid language to me and it's just lacking in polish. -- mvh/best regards Björn Lindqvist -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Multithreading in Factor
Thank you for you response. Regarding the possibility if delegating CPU intensive tasks to multiple tasks: what about communication? Is there an idiomatic way to make processes communicate without blocking? There is ZeroMQ, but as far as I know it is blocking. It would be nice to develop something like Erlang/Akka using a pool of processes and cooperative multithreading locally inside each process, but I am not sure what would be the best way to keep a channel among processes 2014-10-15 14:40 GMT+02:00 Björn Lindqvist bjou...@gmail.com: Hi Andrea, I'm not an expert, so take what's written below with a grain of salt. It mostly comes from what I've snapped up from varius places and reading the mailing list archive (eg http://search.gmane.org/?query=threadinggroup=comp.lang.factor.generalsort=relevance). 2014-10-13 18:14 GMT+02:00 Andrea Ferretti ferrettiand...@gmail.com: Hi, I have read in various places, including this mailing list, that Factor does not currently have support for (preemptive, kernel-level) multithreading, and that adding support for that would require a great deal of changes, since the underlying VM and many core words are not thread-safe. It's true that Factor doesn't have preemptive, kernel-level threading (I'll just write threading from now on when I refer to this particular brand of threading) and that adding it would probably require a lot of engineering and restructuring work. But if you dig into the source, and read the previous discussions, it's clear that adding threading was always the idea and the Factor VM has been architected to make it simple to add in the future. Whether it actually is simple or not, is a different matter. But it's much different from, say, the CPython VM which is implemented in such a way that it would be virtually impossible to add threading. Most composite (non-primitive) words are thread-safe and the primitive words are only thread-unsafe in that critical sections aren't guarded by exclusion locks. Can anyone expand on this? Is there some place where people have collected some ideas about the issues that would arise and the areas that need work? I don't think there is any particularly bloody issues. It's just a lot of hard work. For example interactions between threads and gc can be very tricky. If two threads need to allocate memory, there needs to be some synchronization so that they don't end up pointing to the same chunk of memory. How do you make that both fast and safe? What happens with a threads object references if another thread forces a gc cycle? I guess all threads has to stop running during the gc so that all object references can be updated. It's even more complicated if one thread is in an ffi function which holds a pointer to a Factor object. What if another thread recompiles the same word a thread is running? If not, it would be nice to gather such information from people knowledgeable about the internals of factor, so that interested people could start make some contributions. I don't know if personally I would be able to contribute, but I'd love to if I I found something I could handle An alien wrapper for pthreads would be interesting. I've no idea if it would kind of work or break Factor badly, non-the-less it would be interesting to see. While we're at the subject of threading.. It's a great feature but a language VM can do without it and still be very useful. Python, Erlang, Node.js and Ruby all proves that. If the goal of the concurrency is IO throughput, then cooperative threads which Factor already has works really well. For cpu intensive tasks you can often start multiple processes instead of threading. -- mvh/best regards Björn Lindqvist -- Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://p.sf.net/sfu/Zoho ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://p.sf.net/sfu/Zoho ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Multithreading in Factor
Hi, I have read in various places, including this mailing list, that Factor does not currently have support for (preemptive, kernel-level) multithreading, and that adding support for that would require a great deal of changes, since the underlying VM and many core words are not thread-safe. Can anyone expand on this? Is there some place where people have collected some ideas about the issues that would arise and the areas that need work? If not, it would be nice to gather such information from people knowledgeable about the internals of factor, so that interested people could start make some contributions. I don't know if personally I would be able to contribute, but I'd love to if I I found something I could handle Andrea -- Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://p.sf.net/sfu/Zoho ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Debugging factor
Hi, I am relatively new to Factor, and I am trying understand how to debug programs in it. Whenever I make an error, a popup suggests to Traceback and open the debugger. Now, I am used to the debugger in, say, Smalltalk, where I can browse the current local variables, step into code, edit definitions and so on. Of course the Factor debugger does not show local variables, but this makes the process of debugging completely incomprehensible to me. For the sake of a trivial example, say I want to group a list of numbers by their square, and I enter { 1 2 -2 3 } [ * ] collect-by where the correct form would be { 1 2 -2 3 } [ dup * ] collect-by I see that the call stack holds words having to do with the listener thread both on top and on bottom, where I would have expected to have something related to collect-by. The data stack only informative item is something with the name kernel-error, and the retain stack (what that even is?) holds a few numbers, a few empty containers and a composition which seems the only item relevant to what I have entered. Can someone explain the process to figure out where the error is, or to analyze the situation in more detail? I have the feeling the debugger is a powerful tool, but at my level of experience I cannot make head or tails of it. -- Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://p.sf.net/sfu/Zoho ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Factor IO similar to Node?
Thank you for the explanation! It is nice to see that Factor does automatic task switching on i/o, avoiding the callback hell typical of Node applications 2014-07-10 6:08 GMT+02:00 Chris Double chris.dou...@double.co.nz: A Factor instance runs in a single thread. Blocking operations are done either using non blocking sockets or similar async i/o methods. Task switching occurs on i/o wait or explicit yielding. APIs like ZeroMQ must be wrapped in Factor such that they use the non-block functionality of that API. In the case of ZeroMQ you would use the functionality that allows getting a file handle you can use select/epoll on. You would use this in factor to suspend the factor thread until activity on the file handle occurs at which point the thread would wake up and continue. -- http://www.bluishcoder.co.nz -- Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Factor IO similar to Node?
I am trying to figure what is the Factor model to work with server applications. If I understand correctly, Factor is single threaded, but the underlying I/O facilities are not (I remember reading an article where it was compared to Java NIO). This resembles the model of Node applications: the application logic runs in a single threaded event loop, but the input/output is asynchronous and delegated to background threads, so that applications that are I/O bound can be responsive even on a single thread. Is this correct? What about I/O facilities that are meant to be blocking (for instance, the API of ZeroMQ features a recv() function that blocks until data arrives on the socket)? -- Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] new book including Factor chapter
Great news! Does a book centered only on Factor exist yet? I remember reading that someone (possibly John Benediktsson?) had started one, but I do not find a link anymore 2014-06-25 14:52 GMT+02:00 Fred Daoud fda...@proinbox.com: Seven More Languages in Seven Weeks[1] is now available in beta (pre-release) and includes a chapter on Factor. Thank you Slava Pestov for the interview, and John Benediktsson for the technical review. [1]: http://pragprog.com/titles/7lang Fred -- Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Multithreading
Hi all, I am new to Factor and I am just starting to dablle with it. I have to say that I am impressed that such a small community created a programming language this mature and all the libraries that surround it. I am trying to figure out the current situtation about multithreading. On the one hand, I see that there is a vocabulary for cooperative multithreading, and I remember having read in the docs and in this mailing list that many words are not thread-safe and hence os theads or greenlets (M:N scheduling) are not supported. On the other hand on http://docs.factorcode.org/content/article-concurrency.futures.html I read futures, which are deferred computations performed in a background thread and in fact under the documentation for the future word The quotation begins with an empty data stack, an empty catch stack, and a name stack containing the global namespace only. Am I right in understanding that futures actually do run in a different OS thread that shares nothing with the creating thread? Is there a way to communicate between futures, maybe by passsing some sort of channel into the quotation that starts it, so that one can take advantage of multiple cores in a single factor program? Andrea -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk