Re: [Factor-talk] font sizes in browser und listener

2023-09-21 Thread CW Alston
Hi -- Just joined Discord! How do I find the Factor server there?

On Thu, Sep 21, 2023 at 9:33 AM John Benediktsson  wrote:

> Yes, and we would be happy to help assist.
>
> A fair amount of developer conversation takes place on the Discord server,
> if you want more real-time chats about it.  Or on the Github issue I just
> opened:
>
> https://github.com/factor/factor/issues/2876
>
>
>
> On Sep 21, 2023, at 9:00 AM, Krisztián Schaffer <
> schaffer.kriszt...@gmail.com> wrote:
>
> *Is that something a newcomer can do?*
>
> Hello,
>
> This is my first post here.
>
> I've admired Factor for years, and reading its documentation once helped
> me grasp the concept of refactoring. However, I've never really used it.
>
> Do you think this issue would be a good starting point?
>
> Thanks,
> Krisztián
>
> John Benediktsson  ezt írta (időpont: 2023. szept. 21.,
> Cs, 17:24):
>
>> I suspect if you put those font lines in your .factor-boot-rc and
>> bootstrap it will all look good. We must be caching the default font in
>> places and need that to all be responsive to changes.
>>
>> On Thu, Sep 21, 2023 at 8:22 AM Georg Simon  wrote:
>>
>>> Yes restart and yes new listener window.
>>>
>>> For instance I can start the listener and enter "today".
>>> I get an error message with two tiny lines.
>>> I choose "Use the calendar vocabulary" and get some more tiny messages.
>>>
>>> Am Thu, 21 Sep 2023 08:04:48
>>> -0700 schrieb John Benediktsson :
>>>
>>> > Did you restart Factor after saving? Or open a new listener window?
>>> >
>>> > I noticed the tips of the day at the top don’t properly grow in size
>>> > and that needs to be fixed.
>>> >
>>> >
>>> >
>>> > > On Sep 21, 2023, at 7:19 AM, Georg Simon 
>>> > > wrote:
>>> > >
>>> > > Thank you, much better now.
>>> > > Only the messages printed by the listener are still tiny.
>>> > >
>>> > > Am Tue, 19 Sep 2023 06:27:45 -0700
>>> > > schrieb John Benediktsson :
>>> > >
>>> > >> The quickest way is to change the default-font-size in the fonts
>>> > >> vocab to be larger.
>>> > >>
>>> > >> IN: fonts
>>> > >> CONSTANT: default-font-size 36
>>> > >> “help.stylesheet” reload
>>> > >> save
>>> > >>
>>> > >>
>>> > >>> On Sep 19, 2023, at 12:56 AM, Georg Simon 
>>> > >>> wrote:
>>> > >>>
>>> > >>> Using now 2560x1600 pixels I would like to change all font sizes
>>> > >>> permanently, menu bar and search field included.
>>> > >>>
>>> > >>> Thanks, Georg
>>> > >>>
>>> > >>>
>>> > >>> ___
>>> > >>> 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 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
>


-- 
*~ Memento Amori*
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] gml graphics vocabs unit tests fail

2022-06-12 Thread CW Alston
Hi -
Experimenting with Slava's ``gml'' (Generative Modeling Language)
3D graphics vocabs in ``resource:extra'', I ran into a glitch involving
unit tests.
Some vocabs in the gml directory don't get loaded via ``load-child-vocabs'':
gml.coremath, gml.geometry, & gml.modeling -- thus unit-tests fail.
I'm running
Factor 0.99 x86.64 (2166, heads/master-96743eeca4, May 28 2022 23:43:06)
[Clang (GCC Apple LLVM 13.1.6 (clang-1316.0.21.2.5))] on macosx

IN: scratchpad USE: gml "gml" test ! tests fail

-Crafted a workaround using ``find-vocab-root'' to
fix gml vocabs loading issue:

IN: scratchpad auto-use
"gml" [ find-vocab-root ] keep ! ( -- "resource:extra" "gml" )
append-path! ( -- path ) get gml vocab parent directory
directory-entries [ directory? ] filter
[ name>> "gml." prepend ] map
[ file-extension "examples" = ] reject ! skip gml code examples directory
[ require ] each  ! load all relevant vocabs
"gml" test  ! now all tests succeed

-Is there a better, more direct solution?
Thanks for any advice,
~ CW Alston
-- 
*~ Memento Amori*
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] May 5th

2021-05-12 Thread CW Alston
Co-sign that thanks for posting the video!
Great to see interest in Factor spreading, &
I’ll learn a lot from their work.
Cheers!
~ cw

On Wed, May 12, 2021 at 10:04 PM Sankaranarayanan Viswanathan <
rationalrev...@gmail.com> wrote:

> Thank you for the video! I enjoyed watching it, and they've done a great
> job going over their work on compression and http2 support.
>
> - Sankar
>
> On Wed, May 12, 2021 at 4:47 PM John Benediktsson 
> wrote:
>
>> For anyone that missed the session, or is interested in looking at the 20
>> minute video portion of their presentation, you can look here:
>>
>> https://www.youtube.com/watch?v=lGWMNK5C5go
>>
>> Best,
>> John.
>>
>> On Tue, Apr 20, 2021 at 9:04 AM John Benediktsson 
>> wrote:
>>
>>> Hi everyone,
>>>
>>> We have a team of college students from Harvey Mudd College working on
>>> some improvements to the Factor web frameworks, specifically implementing a
>>> Factor native GZIP vocabulary and a HTTP/2 web server.
>>>
>>> They are going to discuss and present their results on May 5th at 9am
>>> PST online via a Zoom session. It would be nice if anyone with interest
>>> would come and listen and perhaps ask them about their work and future
>>> steps.
>>>
>>> Please write me back directly if you would like an invitation to this
>>> session.
>>>
>>> Best,
>>> John.
>>>
>> ___
>> 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
>
-- 
*~ Memento Amori*
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] May 5th

2021-04-29 Thread CW Alston
Hi John,

I'm interested in learning about the Harvey Mudd projects.

Thanks,
CW (Charles Alston)

On Sun, Apr 25, 2021 at 2:57 AM Sankaranarayanan Viswanathan <
rationalrev...@gmail.com> wrote:

> Hello John,
>
> I'm interested in participating as well.
>
> Thanks!
> Sankar
>
> On Thu, Apr 22, 2021 at 2:57 PM Jon Harper  wrote:
>
>> sure ! How long have they been working on it ? How much time do they have
>> left ?
>> Jon
>>
>> On Thu, Apr 22, 2021 at 1:51 AM cat via Factor-talk
>>  wrote:
>> >
>> > I'm interested!
>> >
>> >
>> >
>> > ‐‐‐ Original Message ‐‐‐
>> > On Tuesday, April 20, 2021 12:04 PM, John Benediktsson <
>> mrj...@gmail.com> wrote:
>> >
>> > Hi everyone,
>> >
>> > We have a team of college students from Harvey Mudd College working on
>> some improvements to the Factor web frameworks, specifically implementing a
>> Factor native GZIP vocabulary and a HTTP/2 web server.
>> >
>> > They are going to discuss and present their results on May 5th at 9am
>> PST online via a Zoom session. It would be nice if anyone with interest
>> would come and listen and perhaps ask them about their work and future
>> steps.
>> >
>> > Please write me back directly if you would like an invitation to this
>> session.
>> >
>> > Best,
>> > John.
>> >
>> >
>> > ___
>> > 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
>


-- 
*~ Memento Amori*
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Some beginner questions with a focus on stack effects

2018-10-07 Thread CW Alston
Hi -
Interesting question, neat recursive solution.
Trying it out, I needed to escape the inner
double quotes in the definition of other-quote:

: other-quote ( quote -- quote’ )
"\""  =  "``"  "\"" ? ;

to pass the compiler, and all worked well.
Cheers,
~cw

On Sun, Oct 7, 2018 at 1:18 PM Luca Di Sera 
wrote:

> Thanks a lot for the explanation.
>
> It was very clear and now it seems almost obvious where the error was. I
> was able to correct another source I wrote where I was stuck on the same
> error.
> Your solution is beautiful. Code like yours is the reason I was drawn to
> factor so much.
>
> I'm really thankful for the help, which was almost instantaneous.
>
> Thanks again,
>Luca Di Sera
>
> Il giorno dom 7 ott 2018 alle ore 14:26 Alexander Ilin 
> ha scritto:
>
>> A shorter way to write `other-quote`:
>>
>> : other-quote ( quote -- quote' )
>>"''" = "``" "''" ? ;
>>
>> 07.10.2018, 15:21, "Alexander Ilin" :
>>
>> Hello, Luca!
>>
>>  Such a humble email, I could not leave without an answer. Questions like
>> this are completely appropriate on this mailing list.
>>
>>  Here are a few changes I made to make your code compilable:
>>
>> WAS:
>> : gather-input ( mapping -- seq\f )
>> readln ;
>>
>> CORRECT:
>> : gather-input ( -- seq\f )
>>readln ;
>>
>>  After that fix, the error you mentioned comes up, the one with the
>> incorrect stack-effects in the `while` call.
>>
>> WAS:
>> : solve ( -- )
>>quote-mapping [ gather-input ] [ prepare-input process-input ] while
>> drop ;
>>
>> CORRECT:
>> : solve ( -- )
>>quote-mapping [ gather-input *dup* ] [ prepare-input process-input ]
>> while *2drop* ;
>>
>>  The `while` word consumes one output of the first quotation (the `?`
>> parameter), so you need to `dup` the output of `gather-input` to keep a
>> copy on the stack for the next quotation.
>>
>>  The general approach you took is fine in Factor, as far as I can see.
>> Here is my solution, similar to yours, but with a slightly different choice
>> of the stream reading method. It uses recursion instead of the `while` loop:
>>
>>
>> USING: kernel io ;
>>
>> IN: 00272_TEX_Quotes
>>
>> : other-quote ( quote -- quote' )
>>"''" = [ "``" ] [ "''" ] if ;
>>
>> : process-input ( quote -- )
>>"\"" read-until swap [ write ] when* [
>>dup write other-quote process-input
>>] [ drop ] if ;
>>
>> : solve ( -- )
>>"``" process-input ;
>>
>> MAIN: solve
>>
>>  This is how I tested it in the listener:
>> "272.txt" utf8 [ solve nl ] with-file-reader
>>
>> 07.10.2018, 13:21, "Luca Di Sera" :
>>
>> Hello to all,
>>
>> I'm a beginner factor programming.
>> I learned about factor in the "Seven More Languages in Seven Weeks"
>> 
>> book and could not avoid falling in love with it.
>> I'm trying to learn it at work in my lunch-breaks and one of the projects
>> I'm following as a didactical exercise is to use it as a secondary language
>> ( to C++ ) to solve competitive programming exercises.
>>
>> Now, It is a few days that I'm stuck on some non-working code that I
>> can't seem to solve on my own, for how embarrassing that is.
>> First of all this is the code:
>>
>>
>> USING: syntax sequences kernel io splitting ;
>>
>> IN: UVa.00272_TEX_Quotes.Factor.00272_TEX_Quotes
>>
>>
>>
>> CONSTANT: quote-mapping { "``" "''" }
>>
>>
>>
>> : switch-quote ( mapping x -- mapping x )
>>
>> [ reverse ] dip ;
>>
>>
>>
>> : print-quote ( mapping x -- mapping x )
>>
>>[ dup first write ] dip ;
>>
>>
>>
>> : gather-input ( mapping -- seq\f )
>>
>> readln ;
>>
>>
>>
>> : prepare-input ( str -- seq )
>>
>> "\"" split ;
>>
>>
>>
>> : process-input ( mapping seq -- mapping )
>>
>> [ print-quote switch-quote write ] each ;
>>
>>
>>
>> : solve ( -- )
>>
>> quote-mapping [ gather-input ] [ prepare-input process-input ] while
>> drop ;
>>
>>
>>
>> MAIN: solve
>>
>>
>> This code is a, currently in testing, solution to UVa 272
>> 
>> .
>> What I was trying to do is the following :
>>
>>
>>1.  Read all lines of input one by one
>>2. For each line that is read split it in a sequence where the " are
>>3. Print the sequence back with quotes between each element (
>>changing between closing and opening quotes )
>>
>> Now, the main problems I'm getting with this codes are related to
>> stack-effects. In particular after solving some of the errors the one I
>> can't currently solve is the following:
>>
>>
>> The word solve cannot be executed because it failed to compile
>>
>>
>>
>> The input quotations to “while” don't match their expected effects
>>
>> Input   Expected Got
>>
>> [ gather-input ]( ..a -- ..b ? ) ( x -- x )
>>
>> [ prepare-input process-input ] ( ..b -- ..a )   ( x x -- x )
>>
>>
>> From my understanding, this is an unbalanced-branches-error.
>> By reading the 

Re: [Factor-talk] Linter for Factor USING: ... ; forms

2018-02-08 Thread CW Alston
Hi all --
I've added a convenience testing word and workflow instructions to the Factor
USING: ... ; forms linter
<https://gist.github.com/cwalston/f6da9cca0105f5d67483935380001d84>,
and tested the code on 10 dozen project vocabs, with --lo and behold-- no
breakage.
I hope some intrepid folks can find the the time to stress-test this code
on their systems, in advance
of the forthcoming .99 release. It may turn out to be a useful start. So
far, my confidence is bolstered,
but let's see if other folks' mileage differs.
Thanks, pro or con,
~cw

On Wed, Feb 7, 2018 at 7:25 PM, CW Alston <cwalsto...@gmail.com> wrote:

> Much improved version of a USING linter here (gist)
> <https://gist.github.com/cwalston/f6da9cca0105f5d67483935380001d84>.
> Tracing through the fuel vocabs, I found that by using `vocab-uses`,
> defined IN: tools.crossref,
> I could get the job done without a temporary file, & the linter code
> dropped from 11 definitions to 7.
> For now, the use case is focussed on linting only the first occurring
> USING: ... ; form.
> I renamed the vocab "lint-using". User interaction works the same way. See
> what you think.
> I'm still pondering all the suggestions in the comments... more to do on
> this.
> Thanks for the help,
> ~cw
>
> On Wed, Feb 7, 2018 at 3:20 PM, CW Alston <cwalsto...@gmail.com> wrote:
>
>> Thanks for the tip, Björn -
>>
>> Being one of those non-emacs users, I never thought to look there. I'll
>> check out how it's done in fuel.
>> ~cw
>>
>>
>> On Wed, Feb 7, 2018 at 8:33 AM, Björn Lindqvist <bjou...@gmail.com>
>> wrote:
>>
>>> Hi guys,
>>>
>>> I haven't tested it but it looks pretty good! But note that FUEL has a
>>> very similar feature. You press C-c C-eu and it finds a minimal using list,
>>> using restarts. So to make a free-standing one (which would be useful
>>> because then non-emacs users can use it), you probably want to look in
>>> fuel-debug-uses.el and fuel.factor for inspiration.
>>>
>>> 2018-02-07 10:44 GMT+01:00 CW Alston <cwalsto...@gmail.com>:
>>>
>>>> Hi again - Posted a cleaned-up, working gist of a USING linter
>>>> <https://gist.github.com/cwalston/f6da9cca0105f5d67483935380001d84>.
>>>> See what you think of it.
>>>> Cheers,
>>>> ~cw
>>>>
>>>> P.S. - cat, I didn't notice your comments until I posted this. I'll
>>>> take a good look
>>>> at your suggestions. Thanks!
>>>> ~cw
>>>> --
>>>> *~ Memento Amori*
>>>>
>>>> 
>>>> --
>>>> Check out the vibrant tech community on one of the world's most
>>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>>> ___
>>>> Factor-talk mailing list
>>>> Factor-talk@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>>>
>>>>
>>>
>>>
>>> --
>>> mvh/best regards Björn Lindqvist
>>>
>>
>>
>>
>> --
>> *~ Memento Amori*
>>
>
>
>
> --
> *~ Memento Amori*
>



-- 
*~ Memento Amori*
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Linter for Factor USING: ... ; forms

2018-02-07 Thread CW Alston
Much improved version of a USING linter here (gist)
<https://gist.github.com/cwalston/f6da9cca0105f5d67483935380001d84>.
Tracing through the fuel vocabs, I found that by using `vocab-uses`,
defined IN: tools.crossref,
I could get the job done without a temporary file, & the linter code
dropped from 11 definitions to 7.
For now, the use case is focussed on linting only the first occurring
USING: ... ; form.
I renamed the vocab "lint-using". User interaction works the same way. See
what you think.
I'm still pondering all the suggestions in the comments... more to do on
this.
Thanks for the help,
~cw

On Wed, Feb 7, 2018 at 3:20 PM, CW Alston <cwalsto...@gmail.com> wrote:

> Thanks for the tip, Björn -
>
> Being one of those non-emacs users, I never thought to look there. I'll
> check out how it's done in fuel.
> ~cw
>
>
> On Wed, Feb 7, 2018 at 8:33 AM, Björn Lindqvist <bjou...@gmail.com> wrote:
>
>> Hi guys,
>>
>> I haven't tested it but it looks pretty good! But note that FUEL has a
>> very similar feature. You press C-c C-eu and it finds a minimal using list,
>> using restarts. So to make a free-standing one (which would be useful
>> because then non-emacs users can use it), you probably want to look in
>> fuel-debug-uses.el and fuel.factor for inspiration.
>>
>> 2018-02-07 10:44 GMT+01:00 CW Alston <cwalsto...@gmail.com>:
>>
>>> Hi again - Posted a cleaned-up, working gist of a USING linter
>>> <https://gist.github.com/cwalston/f6da9cca0105f5d67483935380001d84>.
>>> See what you think of it.
>>> Cheers,
>>> ~cw
>>>
>>> P.S. - cat, I didn't notice your comments until I posted this. I'll take
>>> a good look
>>> at your suggestions. Thanks!
>>> ~cw
>>> --
>>> *~ Memento Amori*
>>>
>>> 
>>> --
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>> ___
>>> Factor-talk mailing list
>>> Factor-talk@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>>
>>>
>>
>>
>> --
>> mvh/best regards Björn Lindqvist
>>
>
>
>
> --
> *~ Memento Amori*
>



-- 
*~ Memento Amori*
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Backtracking

2017-10-08 Thread CW Alston
Alexander, John -

Nice exchange of ideas here; much obliged to you both.
I've attached timers to each approach, and they're comparable,
at approximately a second each.

Alexander, your non-MACRO: def of `last3` -

: last3 ( seq -- X Y Z )
3 cut* nip first3 ; inline

- is very appealing; I'll make use of this. Hadn't thought of it.

John, as usual, your `solve` word cuts straight to the quick, in
illustrating the use of the `backtrack` vocab.

Factor is my 2nd language, after Forth (via Neon, circa 1984!),
& a really great system to explore modern programming.

Onward,
~cw



On Sun, Oct 8, 2017 at 4:05 AM, Alexander Ilin  wrote:

> Hello, John!
>
> 08.10.2017, 07:46, "John Benediktsson" :
>
> Regarding unsafe-amb.  You should use ``amb-lazy`` in compiled words.
> Here's a simple version that prints all solutions.
>
>
> As I said, a perfect solution! Thanks for the `amb-lazy` hint.
>
> ---=---
> Александр
>
>



-- 
*~ Memento Amori*
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Backtracking

2017-10-07 Thread CW Alston
P.S. --  3 small code suggestions:
-for `last3` :
IN: scratchpad { 1 2 3 4 5 6 } 3 tail spill-seq ! or something like it
--- Data stack:
4
5
6
! -
-for `6array` :
IN: scratchpad 5 6 7 8 9 10  6 narray
--- Data stack:
{ 5 6 7 8 9 10 }
! -
 is undefined in Factor Version 0.98; should use `iota`.
I didn't find  anywhere in `sequences` or its child-vocabs.
(I'm running factor-macosx-x86-64-2017-05-14-20-08.dmg):

IN: scratchpad \ 
Error
1: \ 
   ^
No word named “” found in current vocabulary search path


IN: scratchpad \ iota see
USING: kernel math ;
IN: sequences
: iota ( n -- iota )
dup 0 < [ non-negative-integer-expected ] when
iota-tuple boa ; inline
! -
~cw

On Sat, Oct 7, 2017 at 8:55 PM, CW Alston <cwalsto...@gmail.com> wrote:

> Hi Alexander -
> Regarding "Cannot apply “unsafe-amb” to a run-time computed value",
> see `Optimizing compiler` in the source code browser,
> & especially `bad-macro-input` under `Stack checker errors`:
>
> "Most code you write will run with the optimizing compiler. Sometimes,
> the non-optimizing compiler is used, for example for listener
> interactions,
> or for running the quotation passed to call(."
>
> I was bitten by the same compiler issue in my `spill-seq` word (see code
> below).
> My solution worked fine interactively in the Listener, but flunked out in
> a
> source code compile. It took quite a bit of experimentation to compose an
> idiom,
> incorporating a MACRO: definiton & quotation calls, that would compile in
> my source.
> This seems to stem from the use of the optimizing compiler with source
> files,
> whereas the non-optimizing compiler used in the Listener is more
> permissive.
>
> The solution to the puzzle that I wrote doesn't use `amb`. I approached
> the problem
> with `math.combinatorics` & `math.ranges` instead, so I'm not much help
> there.
> But I had to wrestle with the same conundrum, regarding compilation in the
> Listener
> versus source file compilation. See if the example helps. I posted the
> (brief) source
> file below.
>
> I'd be very interested in an approach using `backtracking`!
> Cheers,
> cw
>
> -- alternative solution follows 
>
> ! Copyright (C) 2017 CW Alston.
> ! See http://factorcode.org/license.txt for BSD license.
> USING: combinators.short-circuit fry kernel kernel.private
> locals macros math math.combinatorics math.functions math.ranges
> multiline prettyprint sequences ;
> IN: andrew-task*
>
> ! Problem suggested by Alexander Ilin:
> ! The task is to find digits A, B, C, D, E, and F, such that:
> ! all digits are 1..9,
> ! all of the digits are different,
> ! D < E < F,
> ! ABC*D*EE*FFF = n^2, where n is an integer.
>
> ! number of possible sequences of digits 1-9, taken 6 at a time:
> ! 9 6 nPk . => 60480
>
> ! put sequence elements on the stack
> MACRO: spill-seq ( seq  -- quot )
> '[ _ [ length iota ] keep [ nth ] curry each ] ;
>
> ! check each permutation for solution to task specs
> :: (check-6) ( perm-seq -- ? )
>[ perm-seq spill-seq
> :> F :> E :> D :> C :> B :> A
> {
> [ D E < E F < and ]
> [
>   A 100 * B 10 * C + + :> ABC
>   11 E * :> EE
>   111 F * :> FFF
>   { ABC D EE FFF } product :> prod
>   prod sqrt >integer dup * prod =
> ]
> } 0&& ] ; inline
>
> : 9P6 ( -- permutations )
> 1 9 [a,b] { } clone-like  ! ( -- { 1 2 3 4 5 6 7 8 9 } )
> 6  ; inline   ! ( -- permutations )
>
> : solve-andrew ( -- seq )
> 9P6 [ (check-6) call( -- ? ) ] find nip ;
>
> : solve-andrew. ( -- ) solve-andrew . ;
>
> MAIN: solve-andrew.
>
> /*
> USE: andrew-task*
> IN: scratchpad solve-andrew.
> { 8 1 4 2 3 9 }  ! solution
>
> ! checking:
> IN: scratchpad 8 100 * 1 10 * 4 + + "abc" set
> IN: scratchpad 11 3 * "ee" set
> IN: scratchpad 111 9 * "fff" set
> IN: scratchpad "abc" get 2 "ee" get "fff" get 4 narray
>
> --- Data stack:
> { 814 2 33 999 }
> IN: scratchpad product "prod" set
> IN: scratchpad "prod" get sqrt >integer
>
> --- Data stack:
> 7326
> IN: scratchpad dup *
>
> --- Data stack:
> 53670276
> IN: scratchpad "prod" get = .
> t
> */
> ! -
>
> On Fri, Oct 6, 2017 at 10:30 AM, Alexander Ilin <ajs...@yandex.ru> wrote:
>
>> Hello!
>>
>>   I found a perfect task to learn the `backtrack` vocab, and have
>> successfully solved the problem (although the help s

Re: [Factor-talk] subseq?

2017-01-21 Thread CW Alston
Thanks for the heads-up, John -

I would agree that your changes are a more natural locution. I use these
words a lot
in various vocabs, but I reckon it won't be too hard to adapt to this new
pattern.

Cheers,
~cw

On Fri, Jan 20, 2017 at 10:55 PM, John Benediktsson 
wrote:

> Hi,
>
> I pushed a (breaking compatibility) change to the development branch of
> Factor that swaps the arguments for ``start``, ``start*``, and ``subseq?``.
>
> Instead of:
>
> ( subseq seq -- ? )
>
> it is now:
>
> ( seq subseq -- ? )
>
> It is more natural this way, and most places it was used did some form of
> ``swap subseq?``, but it does create a backwards compatibility problem in a
> relatively common word.
>
> Please let me know if this is a problem for anyone.
>
> Thanks,
> John.
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>


-- 
*~ Memento Amori*
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] El Capitan bug-feature bites normalize-path

2016-06-22 Thread CW Alston
Greetings -

I’d been merrily downloading videos via extra/youtube until I got a

new MacBook Pro & too hastily upgraded to El Capitan. Among other

inconveniences I’ve had to work around because of SIP, the
``download-video’’

word now produces a permissions error:

———-

--- Data stack:

"FfViCWntbDQ"

IN: scratchpad download-video


Unix system call “open” failed:


Permission denied (13)


It was called with the following arguments:


"/Buckminster Fullers Jitterbug.mp4"

1537

438

———-


Digging into the code, I see  that ``normalize-path’’ aims at the “/’’
mount-point

as the current directory for the Unix ``open’’. But SIP won’t allow
modifying

that location without authentication, so ``download-video’’ fails.


If I wrap the code in a ``with-directory’’ combinator setting an allowable

current  directory, I’m back in business:

———-

IN: youtube

SYMBOL: my-youtube-prefix

my-youtube-prefix [ "/Users/cwalston/YouTube/videos" ] initialize


: download-video ( video-id -- )

[ my-youtube-prefix get ] dip! ( -- path video-id )

[ get-video-info

   [

 video-formats [ "type" of "video/mp4" head? ] find nip

 video-download-url

   ] [

   "title" of sanitize ".mp4" append download-to

   ] bi

] curry with-directory ;

———-


It’s actually nicer to be able to set a target download directory, so I
should

thank SIP for goading me out of my laziness. I haven't hunted down all the
spots

where ``normalize-path’’ may choke on the strictures of SIP, but I suspect
this

isn't the last time El Cap will bite working code.


Cheers ~cw

-- 
*~ Memento Amori*
--
Attend Shape: An AT Tech Expo July 15-16. Meet us at AT Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Compile error in tf-idf vocab after upgrade

2015-07-09 Thread CW Alston
Hi John -

Definite yes vote on pushing tf-idf to factor/extra. A boon for anybody
working
on natural language processing with Factor. I found the code easy to extend
(modified it to work with my nosql couchdb-backed project),  a good
stimulus for
learning about vector-based representations of text  all that jazz (cf
google's
word2vec). Factor is a great education in neat topics of modern
programming,
happily open to instructive deconstruction.

Nice work; thanks a lot,
~cw

On Wed, Jul 8, 2015 at 9:11 PM, John Benediktsson mrj...@gmail.com wrote:

 Hi cw,

 Thanks for letting me know, I forgot to update it.  Just now pushed a fix
 if you want to update to latest re-factor:


 https://github.com/mrjbq7/re-factor/commit/d3a33c1dde3574db700392701a273c9ab80b7273

 Maybe tf-idf would be a good candidate vocab to move to factor/extra.

 Best,
 John.



 On Wed, Jul 8, 2015 at 9:00 PM, CW Alston cwalsto...@gmail.com wrote:

 Hi all-
 I've been making good use of the TF-IDF search engine (from the
 supplementary
 utilities at https://github.com/mrjbq7/re-factor).

 After upgrading (on July 6 2015) to:
 Factor 0.98 x86.32 (1631, heads/master-0-g16abe47, Wed Jun 17 21:18:37
 2015)
 [Clang (GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53))] on macosx

 From:
 Factor 0.98 x86.32 (1569, heads/master-0-g1d1ef90, Thu Apr  9 13:07:50
 2015)
 [Clang (GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57))] on macosx

 I found that a newer definition of ``assoc-merge'' in assocs-extras breaks
 the compile of a couple of words in the tf-idf vocab:

 IN: scratchpad  USING: tf-idf  ; ! (current version)

 ! ERROR
 Asset: scores

 Stack effect declaration is wrong
 inferred
 ( x x x -- x )
 declared
 ( query db -- scores )

 Asset: index-all

 Stack effect declaration is wrong
 inferred
 ( x x -- x )
 declared
 ( assoc -- index )

 Here are the pertinent definitions:
 : scores ( query db -- scores )
 [ lower split-words ] dip '[ _ tf-idf ] map assoc-merge ;

 : index1 ( path words -- path index )
 histogram [ pick swap 2array ] assoc-map ;

 : index-all ( assoc -- index )
 [ index1 ] assoc-map values assoc-merge ;

 The problem traces to the newer definition of ``assoc-merge'' in the
 upgrade.

 - new definition:
 USING: assocs kernel math ;
 IN: assocs.extras  ! NEW
 : assoc-merge ( assoc1 assoc2 -- newassoc )
 [ [ [ assoc-size ] bi@ + ] [ drop ] 2bi new-assoc ] 2keep
 [ assoc-merge! ] bi@ ;

 USING: assocs assocs.private kernel ;
 IN: assocs.extras  ! NEW
 : assoc-merge! ( assoc1 assoc2 -- assoc1 )
 over [ push-at ] with-assoc assoc-each ;

 - old definition (in my previous Factor version):
 USING: kernel sequences ;
 IN: assocs.extras ! OLD
 : assoc-merge ( seq -- merge )
 H{ } clone [ (assoc-merge) ] reduce ;

 USING: assocs assocs.private kernel ;
 IN: assocs.extras ! OLD
 : (assoc-merge) ( assoc1 assoc2 -- assoc1 )
 over [ push-at ] with-assoc assoc-each ;

 - This solution works for me, defining:
 : (assoc-merge) ( assoc1 assoc2 -- assoc1 ) ! from old Factor version
 over [ push-at ] with-assoc assoc-each ;

 : seq-assoc-merge ( seq -- merge )
 H{ } clone [ (assoc-merge) ] reduce ;

 - Or just defining ``seq-assoc-merge'' using the new ``assoc-merge!'':
 : seq-assoc-merge ( seq -- merge )
 H{ } clone [ assoc-merge! ] reduce ;

 With these definitions, replacing ``assoc-merge'' w/ ``seq-assoc-merge''
 in
 the tf-idf vocab, ``scores'' and ``index-all'' compile properly again, in
 the upgrade.

 Just a heads up, in case anyone tries out the tf-idf vocab (highly
 recommended; a lot
 of fun figuring out how it works, and good results using it).

 Cheers!
 ~cw



 --
 *~ Memento Amori*


 --
 Don't Limit Your Business. Reach for the Cloud.
 GigeNET's Cloud Solutions provide you with the tools and support that
 you need to offload your IT needs and focus on growing your business.
 Configured For All Businesses. Start Your Cloud Today.
 https://www.gigenetcloud.com/
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk





-- 
*~ Memento Amori*
--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Compile error in tf-idf vocab after upgrade

2015-07-08 Thread CW Alston
Hi all-
I've been making good use of the TF-IDF search engine (from the
supplementary
utilities at https://github.com/mrjbq7/re-factor).

After upgrading (on July 6 2015) to:
Factor 0.98 x86.32 (1631, heads/master-0-g16abe47, Wed Jun 17 21:18:37 2015)
[Clang (GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53))] on macosx

From:
Factor 0.98 x86.32 (1569, heads/master-0-g1d1ef90, Thu Apr  9 13:07:50 2015)
[Clang (GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57))] on macosx

I found that a newer definition of ``assoc-merge'' in assocs-extras breaks
the compile of a couple of words in the tf-idf vocab:

IN: scratchpad  USING: tf-idf  ; ! (current version)

! ERROR
Asset: scores

Stack effect declaration is wrong
inferred
( x x x -- x )
declared
( query db -- scores )

Asset: index-all

Stack effect declaration is wrong
inferred
( x x -- x )
declared
( assoc -- index )

Here are the pertinent definitions:
: scores ( query db -- scores )
[ lower split-words ] dip '[ _ tf-idf ] map assoc-merge ;

: index1 ( path words -- path index )
histogram [ pick swap 2array ] assoc-map ;

: index-all ( assoc -- index )
[ index1 ] assoc-map values assoc-merge ;

The problem traces to the newer definition of ``assoc-merge'' in the
upgrade.

- new definition:
USING: assocs kernel math ;
IN: assocs.extras  ! NEW
: assoc-merge ( assoc1 assoc2 -- newassoc )
[ [ [ assoc-size ] bi@ + ] [ drop ] 2bi new-assoc ] 2keep
[ assoc-merge! ] bi@ ;

USING: assocs assocs.private kernel ;
IN: assocs.extras  ! NEW
: assoc-merge! ( assoc1 assoc2 -- assoc1 )
over [ push-at ] with-assoc assoc-each ;

- old definition (in my previous Factor version):
USING: kernel sequences ;
IN: assocs.extras ! OLD
: assoc-merge ( seq -- merge )
H{ } clone [ (assoc-merge) ] reduce ;

USING: assocs assocs.private kernel ;
IN: assocs.extras ! OLD
: (assoc-merge) ( assoc1 assoc2 -- assoc1 )
over [ push-at ] with-assoc assoc-each ;

- This solution works for me, defining:
: (assoc-merge) ( assoc1 assoc2 -- assoc1 ) ! from old Factor version
over [ push-at ] with-assoc assoc-each ;

: seq-assoc-merge ( seq -- merge )
H{ } clone [ (assoc-merge) ] reduce ;

- Or just defining ``seq-assoc-merge'' using the new ``assoc-merge!'':
: seq-assoc-merge ( seq -- merge )
H{ } clone [ assoc-merge! ] reduce ;

With these definitions, replacing ``assoc-merge'' w/ ``seq-assoc-merge'' in
the tf-idf vocab, ``scores'' and ``index-all'' compile properly again, in
the upgrade.

Just a heads up, in case anyone tries out the tf-idf vocab (highly
recommended; a lot
of fun figuring out how it works, and good results using it).

Cheers!
~cw



-- 
*~ Memento Amori*
--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Glitch in stringxml example?

2015-03-03 Thread CW Alston
Thanks, John - Interesting! ... let me chew on this ~cw

On Tue, Mar 3, 2015 at 6:35 AM, John Benediktsson mrj...@gmail.com wrote:

 Well, this fails:

 bodybr/body stringxml

 But these both succeed:

 bodybr//body stringxml

 bodybr/br/body stringxml

 Looks like it's not proper XHTML?

 If it helps we have HTML5 parsers in html.parser, and words to work with
 it in html.parser.analyzer:

 bodybr/body parse-html

 http://factorcode.org; http-get nip parse-html find-hrefs

 For what its worth, Python seems to have similar error too:

  from xml.dom import minidom
  xmldoc = minidom.parseString(bodybr/body)
 Traceback (most recent call last):
   File stdin, line 1, in module
   File
 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/minidom.py,
 line 1928, in parseString
 return expatbuilder.parseString(string)
   File
 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/expatbuilder.py,
 line 940, in parseString
 return builder.parseString(string)
   File
 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/expatbuilder.py,
 line 223, in parseString
 parser.Parse(string, True)
 xml.parsers.expat.ExpatError: mismatched tag: line 1, column 12



 On Tue, Mar 3, 2015 at 5:11 AM, CW Alston cwalsto...@gmail.com wrote:

 Greetings, folks -
 In an idle moment, I pasted this snippet of example code
 from the factorcode.org page, just for fun:

 USING: io kernel sequences
 http.client xml xml.data xml.traversal ;

 http://factorcode.org; http-get nip stringxml
 a deep-tags-named
 [ href attr ] map
 [ print ] each

 ! this breaks in stringxml w/ the error:

 mismatched
 line   105
 column 0
 open   T{ name f  br http://www.w3.org/1999/xhtml; }
 close  T{ name f  body http://www.w3.org/1999/xhtml; }
 Mismatched tags
 Opening tag: br
 Closing tag: /body

 ! but closing br w/ /br (as per XHTML ??):

 USING: io kernel sequences
 http.client xml xml.data xml.traversal
 splitting ;

 http://factorcode.org; http-get nip
 br br /br replace stringxml
 a deep-tags-named
 [ href attr ] map
 [ print ] each

 ! ...succeeds

 The entry for br in w3schools 'tags' reference
 http://www.w3schools.com/tags/tag_br.asp reads:

 Definition and Usage

 The br tag inserts a single line break.

 The br tag is an empty tag which means that it has no end tag.

 Differences Between HTML 4.01 and HTML5
 NONE.

 Differences Between HTML and XHTML

 In HTML, the br tag has no end tag.

 In XHTML, the br tag must be properly closed, like this: br /.

 However, inserting
 br br  / replace stringxml
 or
 br br / replace stringxml
 still breaks in stringxml, but inserting
 br br /br replace stringxml
 works fine for me.

 Is this just a consequence of the Factor code running on my ancient
 OS X 10.6.8 system (Snow Leopard lives!), or differences between
 XHTML, HTML 4.01, and HTML5, or a wacky description at w3schools?
 Can anyone enlighten me on this, regarding the usage of stringxml?

 Much grass,
 ~cw


 --
 *~ Memento Amori*


 --
 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





-- 
*~ Memento Amori*
--
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] Glitch in stringxml example?

2015-03-03 Thread CW Alston
Greetings, folks -
In an idle moment, I pasted this snippet of example code
from the factorcode.org page, just for fun:

USING: io kernel sequences
http.client xml xml.data xml.traversal ;

http://factorcode.org; http-get nip stringxml
a deep-tags-named
[ href attr ] map
[ print ] each

! this breaks in stringxml w/ the error:

mismatched
line   105
column 0
open   T{ name f  br http://www.w3.org/1999/xhtml; }
close  T{ name f  body http://www.w3.org/1999/xhtml; }
Mismatched tags
Opening tag: br
Closing tag: /body

! but closing br w/ /br (as per XHTML ??):

USING: io kernel sequences
http.client xml xml.data xml.traversal
splitting ;

http://factorcode.org; http-get nip
br br /br replace stringxml
a deep-tags-named
[ href attr ] map
[ print ] each

! ...succeeds

The entry for br in w3schools 'tags' reference
http://www.w3schools.com/tags/tag_br.asp reads:

Definition and Usage

The br tag inserts a single line break.

The br tag is an empty tag which means that it has no end tag.

Differences Between HTML 4.01 and HTML5
NONE.

Differences Between HTML and XHTML

In HTML, the br tag has no end tag.

In XHTML, the br tag must be properly closed, like this: br /.

However, inserting
br br  / replace stringxml
or
br br / replace stringxml
still breaks in stringxml, but inserting
br br /br replace stringxml
works fine for me.

Is this just a consequence of the Factor code running on my ancient
OS X 10.6.8 system (Snow Leopard lives!), or differences between
XHTML, HTML 4.01, and HTML5, or a wacky description at w3schools?
Can anyone enlighten me on this, regarding the usage of stringxml?

Much grass,
~cw


-- 
*~ Memento Amori*
--
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] Factor scripts - just leaking?

2014-02-11 Thread CW Alston
Hi-
I'm experimenting with writing/running executable Factor scripts.
A simple script in a file titled hello -

#! /Applications/factor/factor -script
USING: io ;
hello world print

-does its thing in the terminal, but on the way echos just leaking, thus:

➜  ~ git:(master) ✗ factor /Users/cwalston/factor/hello run-script
2014-02-11 00:09:08.391 factor[7273:903] *** __NSAutoreleaseNoPool():
Object 0x10a500 of class NSPathStore2 autoreleased with no pool in place -
just leaking
...(lots more of the same)
2014-02-11 00:09:08.439 factor[7273:903] *** __NSAutoreleaseNoPool():
Object 0x108690 of class NSCFData autoreleased with no pool in place - just
leaking
hello world
➜  ~ git:(master) ✗

I'm on a Mac. Seems to be expecting an NSAutoReleasePool, so I amend the
script:

#! /Applications/factor/factor -script
USING: io cocoa cocoa.application cocoa.classes ;

IMPORT: NSAutoreleasePool
[ hello world print ] with-autorelease-pool

But I get the same warning.
Can anyone enlighten me as to what's called for here, as far as Factor
code is concerned? Do I have to enable OS garbage collection? If so, how
would I do that?

Thanks kindly,
~cw

-- 
*~ Memento Amori*
--
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151iu=/4140/ostg.clktrk___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor scripts - just leaking?

2014-02-11 Thread CW Alston
I'm running 10.6.8 (Snow Leopard) on a vintage 32-bit MacBook Pro.


On Tue, Feb 11, 2014 at 8:25 AM, John Benediktsson mrj...@gmail.com wrote:

 I don't get those warnings on 10.9.1, which Mac OS X version are you
 running?


 On Tue, Feb 11, 2014 at 2:17 AM, CW Alston cwalsto...@gmail.com wrote:

 Hi-
 I'm experimenting with writing/running executable Factor scripts.
 A simple script in a file titled hello -

 #! /Applications/factor/factor -script
 USING: io ;
 hello world print

 -does its thing in the terminal, but on the way echos just leaking,
 thus:

 ➜  ~ git:(master) ✗ factor /Users/cwalston/factor/hello run-script
 2014-02-11 00:09:08.391 factor[7273:903] *** __NSAutoreleaseNoPool():
 Object 0x10a500 of class NSPathStore2 autoreleased with no pool in place -
 just leaking
 ...(lots more of the same)
 2014-02-11 00:09:08.439 factor[7273:903] *** __NSAutoreleaseNoPool():
 Object 0x108690 of class NSCFData autoreleased with no pool in place - just
 leaking
 hello world
 ➜  ~ git:(master) ✗

 I'm on a Mac. Seems to be expecting an NSAutoReleasePool, so I amend the
 script:

 #! /Applications/factor/factor -script
 USING: io cocoa cocoa.application cocoa.classes ;

 IMPORT: NSAutoreleasePool
 [ hello world print ] with-autorelease-pool

 But I get the same warning.
 Can anyone enlighten me as to what's called for here, as far as Factor
 code is concerned? Do I have to enable OS garbage collection? If so, how
 would I do that?

 Thanks kindly,
 ~cw

 --
 *~ Memento Amori*


 --
 Android apps run on BlackBerry 10
 Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
 Now with support for Jelly Bean, Bluetooth, Mapview and more.
 Get your Android app in front of a whole new audience.  Start now.

 http://pubads.g.doubleclick.net/gampad/clk?id=124407151iu=/4140/ostg.clktrk
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk





-- 
*~ Memento Amori*
--
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151iu=/4140/ostg.clktrk___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor scripts - just leaking?

2014-02-11 Thread CW Alston
A curiosity  a breakthrough -
I discover that simply calling the Factor executable in the terminal (on my
system)
provokes the just leaking warnings, but after that, Factor seems to run
just fine -

➜  ~ git:(master) ✗ factor
2014-02-11 15:25:49.753 factor[3468:903] *** __NSAutoreleaseNoPool():
Object 0x10a4a0 of class NSPathStore2 autoreleased with no pool in place -
just leaking
...
2014-02-11 15:25:49.764 factor[3468:903] *** __NSAutoreleaseNoPool():
Object 0x10db30 of class NSCFData autoreleased with no pool in place - just
leaking
IN: scratchpad

Once there, I can USE: code normally. As a bonus, if I copy the pdfs I need
to my home directory,
calls to docsplit succeed, returning extracted .txt files there (HOME) as
well -

IN: scratchpad docsplit text --no-clean -l eng long_gu004.pdf
run-detached .
T{ process
{ command docsplit text --no-clean -l eng long_gu004.pdf }
{ environment H{ } }
{ environment-mode +append-environment+ }
{ group +same-group+ }
{ handle 3518 }
}

So basically I have to start Factor in the terminal, ignore the warnings,
copy the pdfs I need to $HOME,
and get the extraction work done from there. Copying the files over 
starting Factor from the Finder doesn't
work. At the cost of a little indirection, cracking this docsplit puzzle
saves me a ton of time. Happy now!

I'll keep a watch on the memory issue (probably my aged system), but it
doesn't seem to cause problems so far.
Thanks to all; a collage of the tips you offered has got me over the hump.

Cheers!
~cw


On Tue, Feb 11, 2014 at 1:32 PM, CW Alston cwalsto...@gmail.com wrote:

 I'm running 10.6.8 (Snow Leopard) on a vintage 32-bit MacBook Pro.


 On Tue, Feb 11, 2014 at 8:25 AM, John Benediktsson mrj...@gmail.comwrote:

 I don't get those warnings on 10.9.1, which Mac OS X version are you
 running?


 On Tue, Feb 11, 2014 at 2:17 AM, CW Alston cwalsto...@gmail.com wrote:

 Hi-
 I'm experimenting with writing/running executable Factor scripts.
  A simple script in a file titled hello -

 #! /Applications/factor/factor -script
 USING: io ;
 hello world print

 -does its thing in the terminal, but on the way echos just leaking,
 thus:

 ➜  ~ git:(master) ✗ factor /Users/cwalston/factor/hello run-script
 2014-02-11 00:09:08.391 factor[7273:903] *** __NSAutoreleaseNoPool():
 Object 0x10a500 of class NSPathStore2 autoreleased with no pool in place -
 just leaking
 ...(lots more of the same)
 2014-02-11 00:09:08.439 factor[7273:903] *** __NSAutoreleaseNoPool():
 Object 0x108690 of class NSCFData autoreleased with no pool in place - just
 leaking
 hello world
 ➜  ~ git:(master) ✗

 I'm on a Mac. Seems to be expecting an NSAutoReleasePool, so I amend the
 script:

 #! /Applications/factor/factor -script
 USING: io cocoa cocoa.application cocoa.classes ;

 IMPORT: NSAutoreleasePool
 [ hello world print ] with-autorelease-pool

 But I get the same warning.
 Can anyone enlighten me as to what's called for here, as far as Factor
 code is concerned? Do I have to enable OS garbage collection? If so, how
 would I do that?

 Thanks kindly,
 ~cw

 --
 *~ Memento Amori*


 --
 Android apps run on BlackBerry 10
 Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
 Now with support for Jelly Bean, Bluetooth, Mapview and more.
 Get your Android app in front of a whole new audience.  Start now.

 http://pubads.g.doubleclick.net/gampad/clk?id=124407151iu=/4140/ostg.clktrk
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk





 --
 *~ Memento Amori*




-- 
*~ Memento Amori*
--
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151iu=/4140/ostg.clktrk___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor scripts - just leaking?

2014-02-11 Thread CW Alston
Jumpin' Jehoshaphat!
John - your with-directory suggestion *does* work, with a full path to
the pdf, no need to copy/move the files -

IN: scratchpad
/Users/cwalston/factor/mine/scans/herbal_scans_to_files/14_substances_that_calm_the_spirit/1_substances_that_settle_and_calm_the_spirit/1_long_gu/
[ docsplit text --no-clean -l eng long_gu004.pdf run-detached . ]
with-directory
T{ process
{ command docsplit text --no-clean -l eng long_gu004.pdf }
{ environment H{ } }
{ environment-mode +append-environment+ }
{ group +same-group+ }
{ handle 5420 }
}

Now, I'm cookin' with gas. Thanks again!
~cw


On Tue, Feb 11, 2014 at 6:20 PM, CW Alston cwalsto...@gmail.com wrote:

 Gotcha - I'll check that


 On Tue, Feb 11, 2014 at 5:31 PM, John Benediktsson mrj...@gmail.comwrote:

 I'm sorry, I meant with-directory in io.directories vocabulary:

 IN: scratchpad /path/to/dir [ docsplit file.pdf ] with-directory



 On Tue, Feb 11, 2014 at 5:12 PM, CW Alston cwalsto...@gmail.com wrote:

 1) docsplit still sleeps on this, even in terminal:

 IN: scratchpad docsplit text --no-clean -l chi_sim
 /Users/cwalston/factor/mine/scans/herbal_scans_to_files/14_substances_that_calm_the_spirit/1_substances_that_settle_and_calm_the_spirit/1_long_gu/long_gu001.pdf
 run-detached .
 T{ process
 { command
 docsplit text --no-clean -l chi_sim
 /Users/cwalston/factor/mine/scans/herbal_scans_to_files/14_substances_that_calm_the_spirit/1_substances_that_settle_and_calm_the_spirit/1_long_gu/long_gu001.pdf
  }
 { environment H{ } }
 { environment-mode +append-environment+ }
 { group +same-group+ }
 { handle 5058 }
 }

 2) I don't find with-current-directory. Maybe I can cobble something
 together  with io.directories


 On Tue, Feb 11, 2014 at 4:45 PM, CW Alston cwalsto...@gmail.com wrote:

 Hmm.. I see where you're going. I'll give both a try. Thanks.


 On Tue, Feb 11, 2014 at 4:41 PM, John Benediktsson mrj...@gmail.comwrote:

 Have you tried either:

 1) specifying docsplit /full/path/to/the/file.pdf

 2) IN: scratchpad /full/path/to/the [ docsplit file.pdf ]
 with-current-directory


 On Tue, Feb 11, 2014 at 4:34 PM, CW Alston cwalsto...@gmail.comwrote:

 A curiosity  a breakthrough -
 I discover that simply calling the Factor executable in the terminal
 (on my system)
 provokes the just leaking warnings, but after that, Factor seems to
 run just fine -

 ➜  ~ git:(master) ✗ factor
 2014-02-11 15:25:49.753 factor[3468:903] *** __NSAutoreleaseNoPool():
 Object 0x10a4a0 of class NSPathStore2 autoreleased with no pool in place 
 -
 just leaking
 ...
 2014-02-11 15:25:49.764 factor[3468:903] *** __NSAutoreleaseNoPool():
 Object 0x10db30 of class NSCFData autoreleased with no pool in place - 
 just
 leaking
 IN: scratchpad

 Once there, I can USE: code normally. As a bonus, if I copy the pdfs
 I need to my home directory,
 calls to docsplit succeed, returning extracted .txt files there
 (HOME) as well -

 IN: scratchpad docsplit text --no-clean -l eng long_gu004.pdf
 run-detached .
 T{ process
 { command docsplit text --no-clean -l eng long_gu004.pdf }
 { environment H{ } }
 { environment-mode +append-environment+ }
 { group +same-group+ }
 { handle 3518 }
 }

 So basically I have to start Factor in the terminal, ignore the
 warnings, copy the pdfs I need to $HOME,
 and get the extraction work done from there. Copying the files over 
 starting Factor from the Finder doesn't
 work. At the cost of a little indirection, cracking this docsplit
 puzzle saves me a ton of time. Happy now!

 I'll keep a watch on the memory issue (probably my aged system), but
 it doesn't seem to cause problems so far.
 Thanks to all; a collage of the tips you offered has got me over the
 hump.

 Cheers!
 ~cw


 On Tue, Feb 11, 2014 at 1:32 PM, CW Alston cwalsto...@gmail.comwrote:

 I'm running 10.6.8 (Snow Leopard) on a vintage 32-bit MacBook Pro.


 On Tue, Feb 11, 2014 at 8:25 AM, John Benediktsson mrj...@gmail.com
  wrote:

 I don't get those warnings on 10.9.1, which Mac OS X version are
 you running?


 On Tue, Feb 11, 2014 at 2:17 AM, CW Alston cwalsto...@gmail.comwrote:

 Hi-
 I'm experimenting with writing/running executable Factor scripts.
  A simple script in a file titled hello -

 #! /Applications/factor/factor -script
 USING: io ;
 hello world print

 -does its thing in the terminal, but on the way echos just
 leaking, thus:

 ➜  ~ git:(master) ✗ factor /Users/cwalston/factor/hello
 run-script
 2014-02-11 00:09:08.391 factor[7273:903] ***
 __NSAutoreleaseNoPool(): Object 0x10a500 of class NSPathStore2 
 autoreleased
 with no pool in place - just leaking
 ...(lots more of the same)
 2014-02-11 00:09:08.439 factor[7273:903] ***
 __NSAutoreleaseNoPool(): Object 0x108690 of class NSCFData 
 autoreleased
 with no pool in place - just leaking
 hello world
 ➜  ~ git:(master) ✗

 I'm on a Mac. Seems to be expecting an NSAutoReleasePool, so I
 amend the
 script:

 #! /Applications/factor/factor

Re: [Factor-talk] OCR via docsplit in Factor

2014-02-09 Thread CW Alston
Hi John-
Beg pardon, I should have mentioned earlier that since docsplit plants a
.txt file in the target pdf's
directory on its own, with no other output, I had gone the route you
suggested, but to no avail, i.e.,

docsplit text --no-clean -l path run-process drop

In  the terminal,  cd /path/to/1_long_gu ; docsplit text --no-clean -l
chi_sim long_gu001.pdf
works fine. The surprise is that, in the listener, the phrase:

cd /path/to/1_long_gu ; docsplit text --no-clean -l chi_sim
long_gu001.pdf run-process .

- returns with status 0, but leaves no file. Ditto using /full/path/to/docsplit
in the command.

The docsplit bin alias (/usr/local/opt/ruby/bin/docsplit) resolves
to /usr/local/Cellar/ruby/2.1.0/bin/docsplit
(installed w/ homebrew). There I find this ruby script:

require 'rubygems'

version = = 0

if ARGV.first
  str = ARGV.first
  str = str.dup.force_encoding(BINARY) if str.respond_to? :force_encoding
  if str =~ /\A_(.*)_\z/
version = $1
ARGV.shift
  end
end

gem 'docsplit', version
load Gem.bin_path('docsplit', 'docsplit', version)

If I manage to decipher this, I'll try to translate it in Factor, and
invoke docsplit that way.
That should keep me busy for a while. Worth a try, though I know zip about
ruby. Once past
this boondoggle, I already have Factor code that walks the tree  collates
the files.

Thanks!
~cw




On Sun, Feb 9, 2014 at 4:31 AM, John Benediktsson mrj...@gmail.com wrote:

 If you get lost in path land you can always take a break and use the
 /full/path/to/docsplit.

 On Feb 9, 2014, at 2:03 AM, CW Alston cwalsto...@gmail.com wrote:

 Ah! Thanks, Joe-
 Great tip; should clear up the issue with which. I am indeed starting
 Factor in the Finder. I'll try adjusting the plist.
 Maybe that even has something to do with my docsplit puzzle. Since I can
 address commands like couchdb
 via a process, I should be able to invoke docsplit that way as well,
 even though htop shows me that docsplit
 itself spawns sub-processes, like poppler  tesseract, to do its
 extraction work. Interesting.

 I'll go study the Mac dev doc you point to,  see what I can glean from
 there.

 Back to the books,
 ~cw





 On Sat, Feb 8, 2014 at 10:27 PM, Joe Groff arc...@gmail.com wrote:

 On Sat, Feb 8, 2014 at 7:30 PM, CW Alston cwalsto...@gmail.com wrote:

 Hi -
 Ok, I've upgraded using factor-macosx-x86-32-2013-07-25-14-21.dmg,
 still Version 0.97. Same issue with Factor's which:

 IN: scratchpad USE: tools.which
 IN: scratchpad couchdb which .
 f

 IN: scratchpad python which .
 /usr/bin/python

 - The trouble appears to be with reporting my PATH properly, via getenv:

 IN: scratchpad USE: environment
 IN: scratchpad PATH os-env .
 /usr/bin:/bin:/usr/sbin:/sbin

 IN: scratchpad USE: unix.ffi
 IN: scratchpad PATH getenv .
 /usr/bin:/bin:/usr/sbin:/sbin

 IN: scratchpad \ getenv see
 USING: alien.c-types alien.syntax ;
 IN: unix.ffi
 LIBRARY: libc FUNCTION: c-string getenv ( c-string name ) ;
 inline

 - Here's my actual PATH, as seen in the terminal:

 ➜  ~ git:(master) ✗ echo $PATH

 /usr/local/bin:/usr/local/opt/ruby/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/cwalston/factor:/Users/cwalston/bin:/usr/local/go/bin:/usr/local/lib/node_modules:/usr/local/narwhal/bin:/usr/texbin:/usr/X11/bin:/usr/local/sbin:/Users/cwalston/.gem/ruby/1.8/bin:/Applications/Mozart.app/Contents/Resources/bin

 - whereby which correctly finds couchdb:

 ➜  ~ git:(master) ✗ which couchdb
 /usr/local/bin/couchdb

 So, Factor's which (et al.) doesn't search beyond
 /usr/bin:/bin:/usr/sbin:/sbin.

 Reading through man getenv (GETENV(3), on OSX 10.6.8 ), doesn't give me
 a clue as to how to rectify this short-sightedness via the libc getenv.

 This is probably a side issue to my docsplit quandary (but maybe not).
 Anyone see a way to report my actual PATH to which in Factor? My PATH
 is
 augmented in my .zshrc. I don't understand why the libc function doesn't
 read it. Odd, indeed!

 If you're starting Factor from the Finder, you're not going to get a
 PATH set from your .profile or other shell dotfiles, since UI apps are
 launched under the loginwindow session and not under any shell. To set
 environment variables for UI apps, try setting them in
 ~/.MacOSX/environment.plist:


 https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html

 -Joe




 --
 *~ Memento Amori*




-- 
*~ Memento Amori*
--
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231iu=/4140/ostg.clktrk___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] OCR via docsplit in Factor

2014-02-09 Thread CW Alston
Hi Alex-

Thanks, I did try

/full/path/to/docsplit text --no-clean -l chi_sim
/path/to/1_long_gu/long_gu001.pdf try-process

using both the symlink and the resolved executable:

/usr/local/opt/ruby/bin/docsplit
/usr/local/Cellar/ruby/2.1.0/bin/docsplit

but still no response, still status 0. A lightbulb went on, and I set a
duplicate symlink
in /usr/bin/docsplit (where Factor's which can find it) straight to
/usr/local/Cellar/ruby/2.1.0/bin/docsplit:

IN: scratchpad docsplit which .
/usr/bin/docsplit

-ok, but still no success with anything in io.launcher. Oy!

I see on the web that this problem calling docsplit isn't confined to
Factor. Help calls appear
in Plone-Usershttp://sourceforge.net/mailarchive/message.php?msg_id=29982797
and
stackoverflow re
pythonhttp://stackoverflow.com/questions/18237442/execute-shell-commands-in-python-to-use-docsplit.
Let me dig around some more; this sticky wicket
must have a workaround...

I'll dig around some more.
~cw




On Sun, Feb 9, 2014 at 2:16 PM, Alex Vondrak ajvond...@gmail.com wrote:

 As a follow-up, from Factor you can use `with-directory-files`
 (
 http://docs.factorcode.org/content/word-with-directory-files,io.directories.html
 )
 and `absolute-path`
 (http://docs.factorcode.org/content/word-absolute-path,io.pathnames.html)
 to get full paths to the files in some directory:

 ```
 IN: scratchpad /home/alex/factor/core [ [ absolute-path . ] each ]
 with-directory-files
 /home/alex/factor/core/generic
 /home/alex/factor/core/parser
 /home/alex/factor/core/sorting
 [etc]
 ```


 On Sun, Feb 9, 2014 at 1:53 PM, Alex Vondrak ajvond...@gmail.com wrote:
  It's probably easiest to specify the full path to the file, like I did
  in my previous message.  Combined with the full path to the docsplit
  binary/link (for your particular problem), it should theoretically
  work fine:
 
  /full/path/to/docsplit text --no-clean -l chi_sim
  /path/to/1_long_gu/long_gu001.pdf try-process
 
  On Sun, Feb 9, 2014 at 1:00 PM, CW Alston cwalsto...@gmail.com wrote:
  Hi John-
  Beg pardon, I should have mentioned earlier that since docsplit plants a
  .txt file in the target pdf's
  directory on its own, with no other output, I had gone the route you
  suggested, but to no avail, i.e.,
 
  docsplit text --no-clean -l path run-process drop
 
  In  the terminal,  cd /path/to/1_long_gu ; docsplit text --no-clean -l
  chi_sim long_gu001.pdf
  works fine. The surprise is that, in the listener, the phrase:
 
  cd /path/to/1_long_gu ; docsplit text --no-clean -l chi_sim
 long_gu001.pdf
  run-process .
 
  - returns with status 0, but leaves no file. Ditto using
  /full/path/to/docsplit in the command.
 
  The docsplit bin alias (/usr/local/opt/ruby/bin/docsplit) resolves to
  /usr/local/Cellar/ruby/2.1.0/bin/docsplit
  (installed w/ homebrew). There I find this ruby script:
 
  require 'rubygems'
 
  version = = 0
 
  if ARGV.first
str = ARGV.first
str = str.dup.force_encoding(BINARY) if str.respond_to?
 :force_encoding
if str =~ /\A_(.*)_\z/
  version = $1
  ARGV.shift
end
  end
 
  gem 'docsplit', version
  load Gem.bin_path('docsplit', 'docsplit', version)
 
  If I manage to decipher this, I'll try to translate it in Factor, and
 invoke
  docsplit that way.
  That should keep me busy for a while. Worth a try, though I know zip
 about
  ruby. Once past
  this boondoggle, I already have Factor code that walks the tree 
 collates
  the files.
 
  Thanks!
  ~cw
 
 
 
 
  On Sun, Feb 9, 2014 at 4:31 AM, John Benediktsson mrj...@gmail.com
 wrote:
 
  If you get lost in path land you can always take a break and use the
  /full/path/to/docsplit.
 
  On Feb 9, 2014, at 2:03 AM, CW Alston cwalsto...@gmail.com wrote:
 
  Ah! Thanks, Joe-
  Great tip; should clear up the issue with which. I am indeed starting
  Factor in the Finder. I'll try adjusting the plist.
  Maybe that even has something to do with my docsplit puzzle. Since I
 can
  address commands like couchdb
  via a process, I should be able to invoke docsplit that way as well,
  even though htop shows me that docsplit
  itself spawns sub-processes, like poppler  tesseract, to do its
  extraction work. Interesting.
 
  I'll go study the Mac dev doc you point to,  see what I can glean from
  there.
 
  Back to the books,
  ~cw
 
 
 
 
 
  On Sat, Feb 8, 2014 at 10:27 PM, Joe Groff arc...@gmail.com wrote:
 
  On Sat, Feb 8, 2014 at 7:30 PM, CW Alston cwalsto...@gmail.com
 wrote:
 
  Hi -
  Ok, I've upgraded using factor-macosx-x86-32-2013-07-25-14-21.dmg,
  still Version 0.97. Same issue with Factor's which:
 
  IN: scratchpad USE: tools.which
  IN: scratchpad couchdb which .
  f
 
  IN: scratchpad python which .
  /usr/bin/python
 
  - The trouble appears to be with reporting my PATH properly, via
 getenv:
 
  IN: scratchpad USE: environment
  IN: scratchpad PATH os-env .
  /usr/bin:/bin:/usr/sbin:/sbin
 
  IN: scratchpad USE: unix.ffi
  IN: scratchpad PATH getenv .
  /usr/bin:/bin:/usr/sbin:/sbin

Re: [Factor-talk] OCR via docsplit in Factor

2014-02-09 Thread CW Alston
Yeah, Alex-
I would have thought the cd in my compound command string would take care
of he current directory issue.
There's another thread about this
problemhttp://www.programmingrelief.com/3213645/Docsplit-Works-Fine-In-Command-Line-But-Ignores-Code-In-Ruby-Script%3Fthat
finds docsplit returning files in the root directory - on my system
no files are winding up there.
Let me see what I can do w/ your path/environment suggestions.

Gonna be another long night...
Thanks much,
~cw


On Sun, Feb 9, 2014 at 4:08 PM, Alex Vondrak ajvond...@gmail.com wrote:

 Strange.  Well, not actually strange, since many programs aren't great
 about return codes...but still!  I decided to re-enact the issue by
 removing /usr/local/bin (where my docsplit was installed) from my PATH,
 starting Factor, and trying it out.  Looks like docsplit is dumping the txt
 file in the current working directory:


 IN: scratchpad docsplit which .
 f
 IN: scratchpad docsplit text --no-clean -l eng /tmp/thesis.pdf
 run-process status .
 255
 IN: scratchpad /usr/local/bin/docsplit text --no-clean -l eng
 /tmp/thesis.pdf run-process status .
 0
 IN: scratchpad /tmp/thesis.txt exists? .
 f
 IN: scratchpad thesis.txt exists? .
 t

 Seems as though you need to tell Factor to run in another working
 directory:

 IN: scratchpad /tmp [
 /usr/local/bin/docsplit text --no-clean -l eng /tmp/thesis.pdf
 run-process status .
  ] with-directory
 0
 IN: scratchpad /tmp/thesis.txt exists? .
 t

 By the way, turns out you can set the `environment` slot of an io.launcher
 process, so I was thinking maybe that would help, but...

 IN: scratchpad process
 docsplit text --no-clean -l eng /tmp/thesis.pdf command
 /tmp/stdout.txt stdout
 +stdout+ stderr
 { { PATH /usr/local/bin } } environment
 run-process status .
 1
 IN: scratchpad /tmp/stdout.txt utf8 file-contents print
 sh: 1: pdftotext: not found

 Damn. No dice. Looks like you'll have to fix the PATH issue on the system
 itself.

 Anyway, hope that helps.

 (P.S.: Charles, if you're getting this message again, it's because I think
 GMail might've screwed up the reply behavior and didn't send this to the
 list, so I'm re-sending it.)



 On Sun, Feb 9, 2014 at 3:13 PM, CW Alston cwalsto...@gmail.com wrote:

 Hi Alex-

 Thanks, I did try

 /full/path/to/docsplit text --no-clean -l chi_sim
 /path/to/1_long_gu/long_gu001.pdf try-process

 using both the symlink and the resolved executable:

 /usr/local/opt/ruby/bin/docsplit
 /usr/local/Cellar/ruby/2.1.0/bin/docsplit

 but still no response, still status 0. A lightbulb went on, and I set a
 duplicate symlink
 in /usr/bin/docsplit (where Factor's which can find it) straight to
 /usr/local/Cellar/ruby/2.1.0/bin/docsplit:

 IN: scratchpad docsplit which .
 /usr/bin/docsplit

 -ok, but still no success with anything in io.launcher. Oy!

 I see on the web that this problem calling docsplit isn't confined to
 Factor. Help calls appear
 in 
 Plone-Usershttp://sourceforge.net/mailarchive/message.php?msg_id=29982797 
 and
 stackoverflow re 
 pythonhttp://stackoverflow.com/questions/18237442/execute-shell-commands-in-python-to-use-docsplit.
 Let me dig around some more; this sticky wicket
 must have a workaround...

 I'll dig around some more.
 ~cw




 On Sun, Feb 9, 2014 at 2:16 PM, Alex Vondrak ajvond...@gmail.com wrote:

 As a follow-up, from Factor you can use `with-directory-files`
 (
 http://docs.factorcode.org/content/word-with-directory-files,io.directories.html
 )
 and `absolute-path`
 (http://docs.factorcode.org/content/word-absolute-path,io.pathnames.html
 )
 to get full paths to the files in some directory:

 ```
 IN: scratchpad /home/alex/factor/core [ [ absolute-path . ] each ]
 with-directory-files
 /home/alex/factor/core/generic
 /home/alex/factor/core/parser
 /home/alex/factor/core/sorting
 [etc]
 ```


 On Sun, Feb 9, 2014 at 1:53 PM, Alex Vondrak ajvond...@gmail.com
 wrote:
  It's probably easiest to specify the full path to the file, like I did
  in my previous message.  Combined with the full path to the docsplit
  binary/link (for your particular problem), it should theoretically
  work fine:
 
  /full/path/to/docsplit text --no-clean -l chi_sim
  /path/to/1_long_gu/long_gu001.pdf try-process
 
  On Sun, Feb 9, 2014 at 1:00 PM, CW Alston cwalsto...@gmail.com
 wrote:
  Hi John-
  Beg pardon, I should have mentioned earlier that since docsplit
 plants a
  .txt file in the target pdf's
  directory on its own, with no other output, I had gone the route you
  suggested, but to no avail, i.e.,
 
  docsplit text --no-clean -l path run-process drop
 
  In  the terminal,  cd /path/to/1_long_gu ; docsplit text --no-clean -l
  chi_sim long_gu001.pdf
  works fine. The surprise is that, in the listener, the phrase:
 
  cd /path/to/1_long_gu ; docsplit text --no-clean -l chi_sim
 long_gu001.pdf
  run-process .
 
  - returns with status 0, but leaves no file. Ditto using
  /full/path/to/docsplit in the command.
 
  The docsplit bin alias (/usr

Re: [Factor-talk] OCR via docsplit in Factor

2014-02-09 Thread CW Alston
Lord love a duck, Alex - I didn't realize that builtins like `cd` are
'existentially' different than utilities like `cat` -
(I only speak pidgin unix; bites me often). Thanks for the heads-up.

Okay... I'll try moving|copying my target directory into my home folder, to
obviate the need for any cd'ing (I hope),
 pass docsplit an array of pdfs and flags; or maybe have docsplit iterate
over a tmp file containing lines like:

chi_sim long_gu001.pdf
eng long_gu002.pdf
eng long_gu003.pdf ...

Probably have to do this in a script. Never a dull moment.
~cw



On Sun, Feb 9, 2014 at 6:34 PM, Alex Vondrak ajvond...@gmail.com wrote:

 Thing is, `cd` isn't a binary that Factor can execute in a process.  It's
 just a shell command implemented by bash or zsh or whatever you use.  Same
 with the semicolon syntax, for that matter.  You might try to finagle
 something like

 IN: scratchpad { sh -c cd /tmp ; pwd } utf8 [ contents . ]
 with-process-reader
 /tmp\n

 Not sure how the PATH stuff will work out with that, though.

 You could also try just using the `-o` flag to docsplit.  Again,
 deliberately messing up my PATH so Factor can't run docsplit directly:


 IN: scratchpad docsplit which .
 f
 IN: scratchpad /tmp/thesis.pdf exists? .

 t
 IN: scratchpad /tmp/thesis.txt exists? .
 f
 IN: scratchpad /usr/local/bin/docsplit text --no-clean -l eng
 /tmp/thesis.pdf -o /tmp try-process

 IN: scratchpad /tmp/thesis.txt exists? .
 t



 On Sun, Feb 9, 2014 at 5:02 PM, CW Alston cwalsto...@gmail.com wrote:

 Yeah, Alex-
 I would have thought the cd in my compound command string would take care
 of he current directory issue.
 There's another thread about this 
 problemhttp://www.programmingrelief.com/3213645/Docsplit-Works-Fine-In-Command-Line-But-Ignores-Code-In-Ruby-Script%3Fthat
  finds docsplit returning files in the root directory - on my system
 no files are winding up there.
 Let me see what I can do w/ your path/environment suggestions.

 Gonna be another long night...
 Thanks much,
 ~cw


 On Sun, Feb 9, 2014 at 4:08 PM, Alex Vondrak ajvond...@gmail.com wrote:

 Strange.  Well, not actually strange, since many programs aren't great
 about return codes...but still!  I decided to re-enact the issue by
 removing /usr/local/bin (where my docsplit was installed) from my PATH,
 starting Factor, and trying it out.  Looks like docsplit is dumping the txt
 file in the current working directory:


 IN: scratchpad docsplit which .
 f
 IN: scratchpad docsplit text --no-clean -l eng /tmp/thesis.pdf
 run-process status .
 255
 IN: scratchpad /usr/local/bin/docsplit text --no-clean -l eng
 /tmp/thesis.pdf run-process status .
 0
 IN: scratchpad /tmp/thesis.txt exists? .
 f
 IN: scratchpad thesis.txt exists? .
 t

 Seems as though you need to tell Factor to run in another working
 directory:

 IN: scratchpad /tmp [
 /usr/local/bin/docsplit text --no-clean -l eng /tmp/thesis.pdf
 run-process status .
  ] with-directory
 0
 IN: scratchpad /tmp/thesis.txt exists? .
 t

 By the way, turns out you can set the `environment` slot of an
 io.launcher process, so I was thinking maybe that would help, but...

 IN: scratchpad process
 docsplit text --no-clean -l eng /tmp/thesis.pdf command
 /tmp/stdout.txt stdout
 +stdout+ stderr
 { { PATH /usr/local/bin } } environment
 run-process status .
 1
 IN: scratchpad /tmp/stdout.txt utf8 file-contents print
 sh: 1: pdftotext: not found

 Damn. No dice. Looks like you'll have to fix the PATH issue on the
 system itself.

 Anyway, hope that helps.

 (P.S.: Charles, if you're getting this message again, it's because I
 think GMail might've screwed up the reply behavior and didn't send this to
 the list, so I'm re-sending it.)



 On Sun, Feb 9, 2014 at 3:13 PM, CW Alston cwalsto...@gmail.com wrote:

 Hi Alex-

 Thanks, I did try

 /full/path/to/docsplit text --no-clean -l chi_sim
 /path/to/1_long_gu/long_gu001.pdf try-process

 using both the symlink and the resolved executable:

 /usr/local/opt/ruby/bin/docsplit
 /usr/local/Cellar/ruby/2.1.0/bin/docsplit

 but still no response, still status 0. A lightbulb went on, and I set a
 duplicate symlink
 in /usr/bin/docsplit (where Factor's which can find it) straight to
 /usr/local/Cellar/ruby/2.1.0/bin/docsplit:

 IN: scratchpad docsplit which .
 /usr/bin/docsplit

 -ok, but still no success with anything in io.launcher. Oy!

 I see on the web that this problem calling docsplit isn't confined to
 Factor. Help calls appear
 in 
 Plone-Usershttp://sourceforge.net/mailarchive/message.php?msg_id=29982797
  and
 stackoverflow re 
 pythonhttp://stackoverflow.com/questions/18237442/execute-shell-commands-in-python-to-use-docsplit.
 Let me dig around some more; this sticky wicket
 must have a workaround...

 I'll dig around some more.
 ~cw




 On Sun, Feb 9, 2014 at 2:16 PM, Alex Vondrak ajvond...@gmail.comwrote:

 As a follow-up, from Factor you can use `with-directory-files`
 (
 http://docs.factorcode.org/content/word-with-directory-files

Re: [Factor-talk] OCR via docsplit in Factor

2014-02-08 Thread CW Alston
Thanks for the replies. Maybe a clue here - I get this from which:

IN: scratchpad USE: tools.which
IN: scratchpad docsplit which .
f
IN: scratchpad couchdb which .
f
IN: scratchpad ruby which  .
f

Whereas in the terminal:

➜  ~ git:(master) ✗ which docsplit
/usr/local/opt/ruby/bin/docsplit

➜  ~ git:(master) ✗ which couchdb
/usr/local/bin/couchdb

➜  ~ git:(master) ✗ which ruby
/usr/local/bin/ruby

Let me try moving up to the most recent development release
 see if the problem disappears. I'll get back to you.

Best,
~cw



On Sat, Feb 8, 2014 at 7:42 AM, John Benediktsson mrj...@gmail.com wrote:

 Well if you want process output, you can do something like:

 { docsplit text --no-clean -l path } utf8 [ lines ]
 with-process-reader

 or without output, using a single command string:

 docsplit text --no-clean -l path run-process drop

 You can docsplit a directory of files:

 : docsplit ( file -- )
 { docsplit text --no-clean -l }
 swap prefix run-process drop ;

 : docsplit-all ( path -- )
 directory-files [ docsplit ] each ;

 And concatenate all the files in a directory:

 # bash
 ls *.factor | sort | xargs -I '{}' cat '{}'

 # factor
 : cat-results ( path -- )
 directory-files [ .txt tail? ] filter natural-sort
 [ file-lines ] map concat ;

 Or something like that, which part are you having problems with?

 Best,
 John.



 On Sat, Feb 8, 2014 at 2:32 AM, CW Alston cwalsto...@gmail.com wrote:

 Hi folks -

 I am thrilled to find a versatile open-source optical character
 recognition
 engine called docsplit http://documentcloud.github.io/docsplit/. I've
 got it installed easily as a ruby gem,  it works
 just great on my Mac as a shell command (it also provides a ruby module):

 ➜  ~ git:(master) ✗ which docsplit
 /usr/local/opt/ruby/bin/docsplit
 ➜  ~ git:(master) ✗

 I need such a tool to extract text from a deep directory tree, with a
 couple thousand
 folders. Each leaf folder contains 3-6 scanned pdfs (in Chinese 
 English), from which
 docsplit makes a plaintext (.txt) file with the same basename, deposited
 in the same
 leaf directory. My Factor vocab can easily visit each leaf dir  prepare
 to pass each pdf
 there to docsplit in the format it happily handles in the terminal (I use
 oh-my-zsh  iTerm2).
 My Factor code chokes on this intermediate step, trying to call docsplit.

 Going to the terminal, I have to first cd to the directory containing the
 pdfs, e.g.,

 ➜  ~ git:(master) ✗ cd /path/to/1_long_gu

 then call docsplit with the appropriate flags on each pdf:

 ➜  1_long_gu git:(master) ✗ docsplit text --no-clean -l chi_sim
 long_gu001.pdf
 ➜  1_long_gu git:(master) ✗ docsplit text --no-clean -l eng long_gu002.pdf

 etc., for each pdf,  docsplit gives back a bunch of text files in the
 dir like

 /path/to/1_long_gu/long_gu001.txt

 In the terminal, even a compound phrase like the following works without
 a hitch:

 ➜  ~ git:(master) ✗ cd /path/to/1_long_gu ; docsplit text --no-clean -l
 chi_sim long_gu001.pdf ; docsplit text --no-clean -l eng long_gu002.pdf ;
 docsplit text --no-clean -l eng long_gu003.pdf ;...
 ➜  1_long_gu git:(master) ✗

 So, working from the terminal, I wind up with a series of text files in
 /path/to/1_long_gu
 that my Factor vocab amalgamates into a single text file (with whitespace
 in filename), e.g.,
 /path/to/1_long_gu/long gu.txt, which I can edit for mistakes, and upload
 to a couchdb database.
 Joy!

 But I haven't been able to work out how to accomplish this docsplit call
 from Factor code.
 I have no problem traversing the directory tree (Factor's word each-file
  the like come in
 very handy). I've experimented with io.launcher, io.pipes, shell scripts
 (bash, zsh, factor),
  autoload shell functions, but flunked out. No errors with io.launcher
 tries; just no result.
 Need to learn something here. I routinely launch couchdb as a detached
 process.

 It would be such a boon to use docsplit in Factor. After a couple weeks
 lost at sea with this,
 I'm broadcasting a Mayday. Any suggestions?

 Thanks in advance,
 ~cw

 --
 *~ Memento Amori*


 --
 Managing the Performance of Cloud-Based Applications
 Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
 Read the Whitepaper.

 http://pubads.g.doubleclick.net/gampad/clk?id=121051231iu=/4140/ostg.clktrk
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk





-- 
*~ Memento Amori*
--
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231iu=/4140/ostg.clktrk___
Factor-talk

Re: [Factor-talk] OCR via docsplit in Factor

2014-02-08 Thread CW Alston
Hi -
Ok, I've upgraded using factor-macosx-x86-32-2013-07-25-14-21.dmg,
still Version 0.97. Same issue with Factor's which:

IN: scratchpad USE: tools.which
IN: scratchpad couchdb which .
f

IN: scratchpad python which .
/usr/bin/python

- The trouble appears to be with reporting my PATH properly, via getenv:

IN: scratchpad USE: environment
IN: scratchpad PATH os-env .
/usr/bin:/bin:/usr/sbin:/sbin

IN: scratchpad USE: unix.ffi
IN: scratchpad PATH getenv .
/usr/bin:/bin:/usr/sbin:/sbin

IN: scratchpad \ getenv see
USING: alien.c-types alien.syntax ;
IN: unix.ffi
LIBRARY: libc FUNCTION: c-string getenv ( c-string name ) ;
inline

- Here's my actual PATH, as seen in the terminal:

➜  ~ git:(master) ✗ echo $PATH
/usr/local/bin:/usr/local/opt/ruby/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/cwalston/factor:/Users/cwalston/bin:/usr/local/go/bin:/usr/local/lib/node_modules:/usr/local/narwhal/bin:/usr/texbin:/usr/X11/bin:/usr/local/sbin:/Users/cwalston/.gem/ruby/1.8/bin:/Applications/Mozart.app/Contents/Resources/bin

- whereby which correctly finds couchdb:

➜  ~ git:(master) ✗ which couchdb
/usr/local/bin/couchdb

So, Factor's which (et al.) doesn't search beyond
/usr/bin:/bin:/usr/sbin:/sbin.

Reading through man getenv (GETENV(3), on OSX 10.6.8 ), doesn't give me
a clue as to how to rectify this short-sightedness via the libc getenv.

This is probably a side issue to my docsplit quandary (but maybe not).
Anyone see a way to report my actual PATH to which in Factor? My PATH is
augmented in my .zshrc. I don't understand why the libc function doesn't
read it. Odd, indeed!

~cw


On Sat, Feb 8, 2014 at 4:39 PM, John Benediktsson mrj...@gmail.com wrote:

 Thats odd, Factor's which just looks in the $PATH for your executable.

 IN: scratchpad PATH os-env

 You can read a bit about how its implemented cross-platform:

 http://re-factor.blogspot.com/2013/01/which.html


 On Sat, Feb 8, 2014 at 2:30 PM, CW Alston cwalsto...@gmail.com wrote:

 Thanks for the replies. Maybe a clue here - I get this from which:

 IN: scratchpad USE: tools.which
 IN: scratchpad docsplit which .
 f
 IN: scratchpad couchdb which .
 f
 IN: scratchpad ruby which  .
 f

 Whereas in the terminal:

 ➜  ~ git:(master) ✗ which docsplit
 /usr/local/opt/ruby/bin/docsplit

 ➜  ~ git:(master) ✗ which couchdb
 /usr/local/bin/couchdb

 ➜  ~ git:(master) ✗ which ruby
 /usr/local/bin/ruby

 Let me try moving up to the most recent development release
  see if the problem disappears. I'll get back to you.

 Best,
 ~cw



 On Sat, Feb 8, 2014 at 7:42 AM, John Benediktsson mrj...@gmail.comwrote:

 Well if you want process output, you can do something like:

 { docsplit text --no-clean -l path } utf8 [ lines ]
 with-process-reader

 or without output, using a single command string:

 docsplit text --no-clean -l path run-process drop

 You can docsplit a directory of files:

 : docsplit ( file -- )
 { docsplit text --no-clean -l }
 swap prefix run-process drop ;

 : docsplit-all ( path -- )
 directory-files [ docsplit ] each ;

 And concatenate all the files in a directory:

 # bash
 ls *.factor | sort | xargs -I '{}' cat '{}'

 # factor
 : cat-results ( path -- )
 directory-files [ .txt tail? ] filter natural-sort
 [ file-lines ] map concat ;

 Or something like that, which part are you having problems with?

 Best,
 John.



 On Sat, Feb 8, 2014 at 2:32 AM, CW Alston cwalsto...@gmail.com wrote:

 Hi folks -

 I am thrilled to find a versatile open-source optical character
 recognition
 engine called docsplit http://documentcloud.github.io/docsplit/.
 I've got it installed easily as a ruby gem,  it works
 just great on my Mac as a shell command (it also provides a ruby
 module):

 ➜  ~ git:(master) ✗ which docsplit
 /usr/local/opt/ruby/bin/docsplit
 ➜  ~ git:(master) ✗

 I need such a tool to extract text from a deep directory tree, with a
 couple thousand
 folders. Each leaf folder contains 3-6 scanned pdfs (in Chinese 
 English), from which
 docsplit makes a plaintext (.txt) file with the same basename,
 deposited in the same
 leaf directory. My Factor vocab can easily visit each leaf dir 
 prepare to pass each pdf
 there to docsplit in the format it happily handles in the terminal (I
 use oh-my-zsh  iTerm2).
 My Factor code chokes on this intermediate step, trying to call
 docsplit.

 Going to the terminal, I have to first cd to the directory containing
 the pdfs, e.g.,

 ➜  ~ git:(master) ✗ cd /path/to/1_long_gu

 then call docsplit with the appropriate flags on each pdf:

 ➜  1_long_gu git:(master) ✗ docsplit text --no-clean -l chi_sim
 long_gu001.pdf
 ➜  1_long_gu git:(master) ✗ docsplit text --no-clean -l eng
 long_gu002.pdf

 etc., for each pdf,  docsplit gives back a bunch of text files in the
 dir like

 /path/to/1_long_gu/long_gu001.txt

 In the terminal, even a compound phrase like the following works
 without a hitch:

 ➜  ~ git:(master) ✗ cd /path/to/1_long_gu

[Factor-talk] string formats for sprintf

2013-11-18 Thread CW Alston
Factoristas-

 I've been studying the great economy John B. achieved in his
neat revision of my recently submitted
spotlight.factorhttps://github.com/cwalston/spotlight.factorcode,
especially WRT structuring format strings passed to sprintf, e.g.:

: attr== ( item-name attr-name -- string )
swap %s == '%s' sprintf ;

 The construct %s, which does the heavy lifting, isn't explicitly
illustrated in the doc file format specs for printf, for lc string formats.
In hindsight I can deduce that %s is implicit in the %P.Ds format,
when you don't want padding or require max digits. It might be worthwhile,
for fledgelings, to stick a line in the docs illustrating that using bare
%s
will do in such cases. I totally missed that possibility. Doh!

 Kudos to John; I'm thrilled with the result, overall.

Best,
~cw

-- 
*~ Memento Amori*
--
DreamFactory - Open Source REST  JSON Services for HTML5  Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471iu=/4140/ostg.clktrk___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor interface to Spotlight

2013-11-17 Thread CW Alston
Hi all,

The Factor Spotlight interface is definitely getting somewhere. John B.
(mrjbq7) has
significantly streamlined the code, and whipped up a docs file to boot.
Take a look at
the revision on GitHub https://github.com/cwalston/spotlight.factor, and
give it a whirl. Looks like it may get merged.

Thanks  cheers!
~cw


On Sun, Nov 17, 2013 at 7:49 PM, CW Alston cwalsto...@gmail.com wrote:

 Looks pretty dang good, John -

 Thanks for the emendations. Someday I'll get around to using the scaffold
 tool.
 If it's already in the latest build, I'll check out the new format.

 Much obliged,
 ~cw


 On Sun, Nov 17, 2013 at 6:17 PM, John Benediktsson mrj...@gmail.comwrote:

 Sweet, I merged it and converted a bunch of your comments into help
 documents for the various commands.


 http://gitweb.factorcode.org/gitweb.cgi?p=factor;a=commitdiff;h=803d0d4968733ab17afe0207ee6fed63f91abcfc;hp=c6e217da0600b98e17cb09143c06675c51afddcd

 Let me know what you think.

 P.S. if you update from github you'll have to wait a bit for us to get
 the sync script working as the factorcode server was upgraded and it looks
 like it isn't working properly yet.




 On Sat, Nov 16, 2013 at 7:40 PM, CW Alston cwalsto...@gmail.com wrote:

 Hi John,

  That sounds great. I just now set up the code on 
 GitHubhttps://github.com/cwalston/spotlight.factor,
 and added the factorcode BSD license line.
 First time for me; hope I got the hairy thing right. Being brand new to
 collaborative coding, I don't know
 the etiquette on adding contributors names. I got so much help, I reckon
 other names should be added.
 Let me know what to do about that.

  The solution to the problem of gathering all kMDItem atributes was
 staring me in the face, but I didn't
 see it until this evening. It's added in the GiHub code.

  I hope folks can put spotlight.factor through its paces,  suggest
 improvements.
 Thanks to all for the patient help.

 Cheers!
 ~cw


 On Sat, Nov 16, 2013 at 4:13 PM, John Benediktsson mrj...@gmail.comwrote:

 Hi,

 I'd like to merge this into the main repository, i see that it is
 copyright you, would you like to make it available to us with BSD license
 like the other factorcode?

 Thanks,
 John.


 On Wed, Nov 13, 2013 at 4:58 PM, CW Alston cwalsto...@gmail.comwrote:

 A good point, Björn -

  Since the number of elements is known beforehand in mdutil  mdls, an
 immutable array
 would suffice ( use less words). I carried the vector format over
 from a previous incarnation
 of md-command, where I didn't know how many elems would be needed in
 the array.

 I'm not religious about mutating data structures, but your suggestion
 makes the code more succinct.

 Thanks,
 ~cw


 On Wed, Nov 13, 2013 at 5:04 AM, Björn Lindqvist bjou...@gmail.comwrote:

 Here are some random tips from me. I'm also a Factor newbie so take it
 with a grain of salt:

  * Don't use vectors because normal sequences works just as well.
  * Be functional! Avoid words that mutate data structures because they
 make the code harder to reason about.

 F.e. this piece of code in mdls:

 mdls 1vector swap suffix!

 can be written as just:

 mdls swap 2array

 Another example is your mdutil word:

 :: (mdutil) ( flags on|off volume root/owner -- seq )
 root/owner 1vector - flags append suffix!
 -i suffix! on|off suffix! volume suffix!

 It's a great showcase for local variables but can be better written
 without array mutations:

 :: mdutil ( flags on|off volume root/owner -- seq )
 root/owner flags - prepend -i on|off volume 5 narray


 2013/11/13 CW Alston cwalsto...@gmail.com:
   I've posted a new gist for spotlight.factor w/ filename  Factor
  formatting.
  I think I dealt with most of Alex's red-lines,  I shed the string
  constants.
  The whole thing is much shorter. The included examples work on my
 machine.
 
   The file can be USE:d from the listener if you give it a folder in
 your
  'work'.
 
   After a long divagation, looks like I've wound up back where John
  Alex
  suggested I start, 3 weeks ago. Well, like I was warned in the Boy
 Scouts,
  when you wander lost in the woods, you tend to go 'round in circles.
  Just couldn't see how to get on from there without a compass (or
 native
  guides),
   I did learn a lot along the way. Still needs some improvement
 (maybe bug
  fixes, too).
 
   In particular, I'd like to memoize an API call to
  MDSchemaCopyAllAttributes(),
  but I'm better at Chinese than C. Pointers on alien-invoke, or what
 else to
  use?



 --
 mvh/best regards Björn Lindqvist




 --
 *~ Memento Amori*


 --
 DreamFactory - Open Source REST  JSON Services for HTML5  Native Apps
 OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
 Free app hosting. Or install the open source package on any LAMP
 server.
 Sign up and see examples for AngularJS, jQuery, Sencha Touch and
 Native!

 http

Re: [Factor-talk] Factor interface to Spotlight

2013-11-16 Thread CW Alston
Hi John,

 That sounds great. I just now set up the code on
GitHubhttps://github.com/cwalston/spotlight.factor,
and added the factorcode BSD license line.
First time for me; hope I got the hairy thing right. Being brand new to
collaborative coding, I don't know
the etiquette on adding contributors names. I got so much help, I reckon
other names should be added.
Let me know what to do about that.

 The solution to the problem of gathering all kMDItem atributes was staring
me in the face, but I didn't
see it until this evening. It's added in the GiHub code.

 I hope folks can put spotlight.factor through its paces,  suggest
improvements.
Thanks to all for the patient help.

Cheers!
~cw


On Sat, Nov 16, 2013 at 4:13 PM, John Benediktsson mrj...@gmail.com wrote:

 Hi,

 I'd like to merge this into the main repository, i see that it is
 copyright you, would you like to make it available to us with BSD license
 like the other factorcode?

 Thanks,
 John.


 On Wed, Nov 13, 2013 at 4:58 PM, CW Alston cwalsto...@gmail.com wrote:

 A good point, Björn -

  Since the number of elements is known beforehand in mdutil  mdls, an
 immutable array
 would suffice ( use less words). I carried the vector format over from a
 previous incarnation
 of md-command, where I didn't know how many elems would be needed in
 the array.

 I'm not religious about mutating data structures, but your suggestion
 makes the code more succinct.

 Thanks,
 ~cw


 On Wed, Nov 13, 2013 at 5:04 AM, Björn Lindqvist bjou...@gmail.comwrote:

 Here are some random tips from me. I'm also a Factor newbie so take it
 with a grain of salt:

  * Don't use vectors because normal sequences works just as well.
  * Be functional! Avoid words that mutate data structures because they
 make the code harder to reason about.

 F.e. this piece of code in mdls:

 mdls 1vector swap suffix!

 can be written as just:

 mdls swap 2array

 Another example is your mdutil word:

 :: (mdutil) ( flags on|off volume root/owner -- seq )
 root/owner 1vector - flags append suffix!
 -i suffix! on|off suffix! volume suffix!

 It's a great showcase for local variables but can be better written
 without array mutations:

 :: mdutil ( flags on|off volume root/owner -- seq )
 root/owner flags - prepend -i on|off volume 5 narray


 2013/11/13 CW Alston cwalsto...@gmail.com:
   I've posted a new gist for spotlight.factor w/ filename  Factor
  formatting.
  I think I dealt with most of Alex's red-lines,  I shed the string
  constants.
  The whole thing is much shorter. The included examples work on my
 machine.
 
   The file can be USE:d from the listener if you give it a folder in
 your
  'work'.
 
   After a long divagation, looks like I've wound up back where John 
 Alex
  suggested I start, 3 weeks ago. Well, like I was warned in the Boy
 Scouts,
  when you wander lost in the woods, you tend to go 'round in circles.
  Just couldn't see how to get on from there without a compass (or native
  guides),
   I did learn a lot along the way. Still needs some improvement (maybe
 bug
  fixes, too).
 
   In particular, I'd like to memoize an API call to
  MDSchemaCopyAllAttributes(),
  but I'm better at Chinese than C. Pointers on alien-invoke, or what
 else to
  use?



 --
 mvh/best regards Björn Lindqvist




 --
 *~ Memento Amori*


 --
 DreamFactory - Open Source REST  JSON Services for HTML5  Native Apps
 OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
 Free app hosting. Or install the open source package on any LAMP server.
 Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!

 http://pubads.g.doubleclick.net/gampad/clk?id=63469471iu=/4140/ostg.clktrk

 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk





-- 
*~ Memento Amori*
--
DreamFactory - Open Source REST  JSON Services for HTML5  Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471iu=/4140/ostg.clktrk___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor interface to Spotlight

2013-11-13 Thread CW Alston
A good point, Björn -

 Since the number of elements is known beforehand in mdutil  mdls, an
immutable array
would suffice ( use less words). I carried the vector format over from a
previous incarnation
of md-command, where I didn't know how many elems would be needed in the
array.

I'm not religious about mutating data structures, but your suggestion makes
the code more succinct.

Thanks,
~cw


On Wed, Nov 13, 2013 at 5:04 AM, Björn Lindqvist bjou...@gmail.com wrote:

 Here are some random tips from me. I'm also a Factor newbie so take it
 with a grain of salt:

  * Don't use vectors because normal sequences works just as well.
  * Be functional! Avoid words that mutate data structures because they
 make the code harder to reason about.

 F.e. this piece of code in mdls:

 mdls 1vector swap suffix!

 can be written as just:

 mdls swap 2array

 Another example is your mdutil word:

 :: (mdutil) ( flags on|off volume root/owner -- seq )
 root/owner 1vector - flags append suffix!
 -i suffix! on|off suffix! volume suffix!

 It's a great showcase for local variables but can be better written
 without array mutations:

 :: mdutil ( flags on|off volume root/owner -- seq )
 root/owner flags - prepend -i on|off volume 5 narray


 2013/11/13 CW Alston cwalsto...@gmail.com:
   I've posted a new gist for spotlight.factor w/ filename  Factor
  formatting.
  I think I dealt with most of Alex's red-lines,  I shed the string
  constants.
  The whole thing is much shorter. The included examples work on my
 machine.
 
   The file can be USE:d from the listener if you give it a folder in your
  'work'.
 
   After a long divagation, looks like I've wound up back where John  Alex
  suggested I start, 3 weeks ago. Well, like I was warned in the Boy
 Scouts,
  when you wander lost in the woods, you tend to go 'round in circles.
  Just couldn't see how to get on from there without a compass (or native
  guides),
   I did learn a lot along the way. Still needs some improvement (maybe
 bug
  fixes, too).
 
   In particular, I'd like to memoize an API call to
  MDSchemaCopyAllAttributes(),
  but I'm better at Chinese than C. Pointers on alien-invoke, or what else
 to
  use?



 --
 mvh/best regards Björn Lindqvist




-- 
*~ Memento Amori*
--
DreamFactory - Open Source REST  JSON Services for HTML5  Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471iu=/4140/ostg.clktrk___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor interface to Spotlight

2013-11-12 Thread CW Alston
Hi folks,

 I've posted a new gist for
spotlight.factorhttps://gist.github.com/cwalston/7425403w/ filename
 Factor formatting.
I think I dealt with most of Alex's red-lines,  I shed the string
constants.
The whole thing is much shorter. The included examples work on my machine.

 The file can be USE:d from the listener if you give it a folder in your
'work'.

 After a long divagation, looks like I've wound up back where John  Alex
suggested I start, 3 weeks ago. Well, like I was warned in the Boy Scouts,
when you wander lost in the woods, you tend to go 'round in circles.
Just couldn't see how to get on from there without a compass (or native
guides),
 I did learn a lot along the way. Still needs some improvement (maybe bug
fixes, too).

 In particular, I'd like to memoize an API call to
MDSchemaCopyAllAttributes(),
but I'm better at Chinese than C. Pointers on alien-invoke, or what else to
use?

Thanks,
CW Alston



On Mon, Nov 11, 2013 at 4:29 PM, John Benediktsson mrj...@gmail.com wrote:

 I agree with Alex's comments and would add one thing, which is if you like
 all your constants (so you don't have to remember them), instead of
 creating all the specialized words like by-Author, maybe just have the
 constants and then a generic by-attribute so using Alex's mdfind:

 CONSTANT: Author kMDItemAuthor

 : mdfind-by ( value name -- results )
 swap %s = '%s' sprintf mdfind ;

 So you could do:

 IN: scratchpad Stephen King Author mdfind-by









 On Mon, Nov 11, 2013 at 3:39 PM, CW Alston cwalsto...@gmail.com wrote:

 Phew! - let me co-sign you on that, with a hearty Thanks, Alex!

  I really appreciate the time you took to run a fine-toothed comb through
 through
 such a heap of code. Lots to chew on, and learn from. All your points
 make sense.
 (Sorry about all the SHOUTING, lol - just a visual crutch for me, but I
 can wean
 myself away from stylistic improprieties).

  Edified, encouraged, let me see what improvements I can come up with.

 Thanks again. Back to the future (though that may take a while...),
 ~cw


 On Mon, Nov 11, 2013 at 10:57 AM, Alex Vondrak ajvond...@gmail.comwrote:

 I have too much formatting (and email always has a way of wrecking
 that), so I put a comment on the gist:
 https://gist.github.com/cwalston/7368493#comment-948159

 Have a good one,
 --Alex Vondrak


 On Mon, Nov 11, 2013 at 1:28 AM, CW Alston cwalsto...@gmail.com wrote:
  Hi all-
 
   Re-factoring 'spotlight.factor' worked better than SlimFast. Look
 Ma, no
  files!
  Much obliged for the pointers on how to set up commands for
  with-process-reader.
 
   I've replaced the code in the Gist previously posted with a revised,
  self-contained
  version. Please do take a look  beat on the code. It should compile
 fine
  simply
  pasted whole in the listener. I'm sure many query formatting cases
 aren't
  covered yet.
 
   There are a passel of terminal examples to try to emulate at the end
 of the
  file.
  As there are myriad variations in formatting terminal commands, it
 would be
  good to
  have as general an interface from Factor as possible. I'd like to
 develop
  'spotlight'
  into a practical utility. Suggestions? Feedback appreciated.
 
  Thanks kindly,
  ~ CW Alston
 
 
 
  On Sat, Nov 9, 2013 at 7:43 PM, CW Alston cwalsto...@gmail.com
 wrote:
 
  Great help, folks!
 
  I think I can figure this out now. With a l'il more elbow-grease 
 your
  pointers,
  I'd like to make the 2 crutch files disappear,  access the MetaData
 index
  in all its glory directly. That certainly would make this a much more
  independent,
  self-contained utility. Useful breakdown, Alex. Back to the drawing
 board.
 
  Thanks, all -
  ~cw
 
 
 
  On Sat, Nov 9, 2013 at 8:36 AM, John Benediktsson mrj...@gmail.com
  wrote:
 
  This works for me, it has to be a string or sequence of strings:
 
  IN: scratchpad { mdfind kMDItemComposer == 'Andrea Bocelli' }
 utf8 [
  lines ] with-process-reader
 
  Anyway, I love this vocab and getting it to work is like 95% of the
  challenge, I think it would be fun to modify it to not require the
  indirection and contribute it to the main repository if you're
 interested!
 
  Best,
  John.
 
 
 
  On Fri, Nov 8, 2013 at 10:11 PM, CW Alston cwalsto...@gmail.com
 wrote:
 
  Hi John,
 
  I can't get your suggestion to work with mdfind:
 
   Why go through the indirection of a shell script and a query
 results
   rather than just preparing
   a sequence of args and then grabbing all the results, e.g.
   { mdfind kMDItemAuthor == '*MyFavoriteAuthor*' } utf8 [ lines ]
   with-process-reader
 
  - Trying this command format (with a different MD Attribute) works
 fine
  in the terminal:
 
  ➜  ~ git:(master) ✗ mdfind kMDItemComposer == 'Dylan'
  /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/11
  Wedding Song.m4a
  /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/10
 Never
  Say Goodbye.m4a
  /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/09

Re: [Factor-talk] Factor interface to Spotlight

2013-11-11 Thread CW Alston
Hi all-

 Re-factoring 'spotlight.factor' worked better than SlimFast. *Look Ma, no
files*!
Much obliged for the pointers on how to set up commands for
with-process-reader.

 I've replaced the code in the Gist previously posted with a revised,
self-contained https://gist.github.com/cwalston/7368493
version https://gist.github.com/cwalston/7368493. Please do take a look 
beat on the code. It should compile fine simply
pasted whole in the listener. I'm sure many query formatting cases
aren't covered yet.

 There are a passel of terminal examples to try to emulate at the end of
the file.
As there are myriad variations in formatting terminal commands, it would be
good to
have as general an interface from Factor as possible. I'd like to develop
'spotlight'
into a practical utility. Suggestions? Feedback appreciated.

Thanks kindly,
~ CW Alston



On Sat, Nov 9, 2013 at 7:43 PM, CW Alston cwalsto...@gmail.com wrote:

 Great help, folks!

 I think I can figure this out now. With a l'il more elbow-grease  your
 pointers,
 I'd like to make the 2 crutch files disappear,  access the MetaData index
 in all its glory directly. That certainly would make this a much more
 independent,
 self-contained utility. Useful breakdown, Alex. Back to the drawing board.

 Thanks, all -
 ~cw



 On Sat, Nov 9, 2013 at 8:36 AM, John Benediktsson mrj...@gmail.comwrote:

 This works for me, it has to be a string or sequence of strings:

 IN: scratchpad { mdfind kMDItemComposer == 'Andrea Bocelli' } utf8 [
 lines ] with-process-reader

 Anyway, I love this vocab and getting it to work is like 95% of the
 challenge, I think it would be fun to modify it to not require the
 indirection and contribute it to the main repository if you're interested!

 Best,
 John.



 On Fri, Nov 8, 2013 at 10:11 PM, CW Alston cwalsto...@gmail.com wrote:

 Hi John,

 I can't get your suggestion to work with mdfind:

  Why go through the indirection of a shell script and a query results
 rather than just preparing
  a sequence of args and then grabbing all the results, e.g.
  { mdfind kMDItemAuthor == '*MyFavoriteAuthor*' } utf8 [ lines ]
 with-process-reader

 - Trying this command format (with a different MD Attribute) works fine
 in the terminal:

 ➜  ~ git:(master) ✗ mdfind kMDItemComposer == 'Dylan'
 /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/11
 Wedding Song.m4a
 /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/10 Never
 Say Goodbye.m4a
 /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/09 You
 Angel You.m4a
 /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/08
 Dirge.m4a
 ...
 ➜  ~ git:(master) ✗

 - But trying the same command in the with-process-reader format fails in
 the listener:

 IN: scratchpad { mdfind kMDItemComposer == 'Dylan' } utf8 [ lines ]
 with-process-reader

 Process exited with error code 254

 Launch descriptor:

 T{ process
 { command { mdfind kMDItemComposer == 'Dylan' } }
 { environment H{ } }
 { environment-mode +append-environment+ }
 { stdout T{ fd { disposed t } { fd 23 } } }
 { group +same-group+ }
 { status 254 }
 { pipe
 T{ pipe
 { in T{ fd { disposed t } { fd 19 } } }
 { out T{ fd { disposed t } { fd 23 } } }
 }
 }
 }
 ---
 -Switching single  double quotes around doesn't help:
 IN: scratchpad { mdfind 'kMDItemComposer == Dylan' } utf8 [ lines ]
 with-process-reader

 Error
 No word named “'kMDItemComposer” found in current vocabulary search path
 (however, mdfind 'kMDItemComposer == Dylan' works in terminal)

 ---
 -Ok, so trying various permutations of single, double, triple quotes in
 the command:
 IN: scratchpad { mdfind kMDItemComposer == 'Dylan' } utf8 [
 lines ] with-process-reader

 Process exited with error code 255
 (however, mdfind kMDItemComposer == 'Dylan' works in terminal)

 ---
 IN: scratchpad { mdfind 'kMDItemComposer == Dylan' } utf8 [
 lines ] with-process-reader

 Process exited with error code 255
 (however, mdfind 'kMDItemComposer == Dylan' works in terminal)

 ---
 IN: scratchpad { mdfind 'kMDItemComposer == Dylan' } utf8 [
 lines ] with-process-reader

 Process exited with error code 1
 (again, mdfind 'kMDItemComposer == Dylan' works in terminal)

 ---
 -Using the code from the spotlight.factor vocab works like the terminal
 example above:
 IN: scratchpad Dylan by-Composer mdfind .

 {
 /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/11
 Wedding Song.m4a
 /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/10
 Never Say Goodbye.m4a
 /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/09
 You Angel You.m4a
 /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/08
 Dirge.m4a
 /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/07
 Forever Young (Continued).m4a
 /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/06

Re: [Factor-talk] Factor interface to Spotlight

2013-11-11 Thread CW Alston
Phew! - let me co-sign you on that, with a hearty Thanks, Alex!

 I really appreciate the time you took to run a fine-toothed comb through
through
such a heap of code. Lots to chew on, and learn from. All your points make
sense.
(Sorry about all the SHOUTING, lol - just a visual crutch for me, but I can
wean
myself away from stylistic improprieties).

 Edified, encouraged, let me see what improvements I can come up with.

Thanks again. Back to the future (though that may take a while...),
~cw


On Mon, Nov 11, 2013 at 10:57 AM, Alex Vondrak ajvond...@gmail.com wrote:

 I have too much formatting (and email always has a way of wrecking
 that), so I put a comment on the gist:
 https://gist.github.com/cwalston/7368493#comment-948159

 Have a good one,
 --Alex Vondrak


 On Mon, Nov 11, 2013 at 1:28 AM, CW Alston cwalsto...@gmail.com wrote:
  Hi all-
 
   Re-factoring 'spotlight.factor' worked better than SlimFast. Look Ma,
 no
  files!
  Much obliged for the pointers on how to set up commands for
  with-process-reader.
 
   I've replaced the code in the Gist previously posted with a revised,
  self-contained
  version. Please do take a look  beat on the code. It should compile fine
  simply
  pasted whole in the listener. I'm sure many query formatting cases aren't
  covered yet.
 
   There are a passel of terminal examples to try to emulate at the end of
 the
  file.
  As there are myriad variations in formatting terminal commands, it would
 be
  good to
  have as general an interface from Factor as possible. I'd like to develop
  'spotlight'
  into a practical utility. Suggestions? Feedback appreciated.
 
  Thanks kindly,
  ~ CW Alston
 
 
 
  On Sat, Nov 9, 2013 at 7:43 PM, CW Alston cwalsto...@gmail.com wrote:
 
  Great help, folks!
 
  I think I can figure this out now. With a l'il more elbow-grease  your
  pointers,
  I'd like to make the 2 crutch files disappear,  access the MetaData
 index
  in all its glory directly. That certainly would make this a much more
  independent,
  self-contained utility. Useful breakdown, Alex. Back to the drawing
 board.
 
  Thanks, all -
  ~cw
 
 
 
  On Sat, Nov 9, 2013 at 8:36 AM, John Benediktsson mrj...@gmail.com
  wrote:
 
  This works for me, it has to be a string or sequence of strings:
 
  IN: scratchpad { mdfind kMDItemComposer == 'Andrea Bocelli' } utf8
 [
  lines ] with-process-reader
 
  Anyway, I love this vocab and getting it to work is like 95% of the
  challenge, I think it would be fun to modify it to not require the
  indirection and contribute it to the main repository if you're
 interested!
 
  Best,
  John.
 
 
 
  On Fri, Nov 8, 2013 at 10:11 PM, CW Alston cwalsto...@gmail.com
 wrote:
 
  Hi John,
 
  I can't get your suggestion to work with mdfind:
 
   Why go through the indirection of a shell script and a query results
   rather than just preparing
   a sequence of args and then grabbing all the results, e.g.
   { mdfind kMDItemAuthor == '*MyFavoriteAuthor*' } utf8 [ lines ]
   with-process-reader
 
  - Trying this command format (with a different MD Attribute) works
 fine
  in the terminal:
 
  ➜  ~ git:(master) ✗ mdfind kMDItemComposer == 'Dylan'
  /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/11
  Wedding Song.m4a
  /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/10
 Never
  Say Goodbye.m4a
  /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/09 You
  Angel You.m4a
  /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/08
  Dirge.m4a
  ...
  ➜  ~ git:(master) ✗
 
  - But trying the same command in the with-process-reader format fails
 in
  the listener:
 
  IN: scratchpad { mdfind kMDItemComposer == 'Dylan' } utf8 [ lines ]
  with-process-reader
 
  Process exited with error code 254
 
  Launch descriptor:
 
  T{ process
  { command { mdfind kMDItemComposer == 'Dylan' } }
  { environment H{ } }
  { environment-mode +append-environment+ }
  { stdout T{ fd { disposed t } { fd 23 } } }
  { group +same-group+ }
  { status 254 }
  { pipe
  T{ pipe
  { in T{ fd { disposed t } { fd 19 } } }
  { out T{ fd { disposed t } { fd 23 } } }
  }
  }
  }
  ---
  -Switching single  double quotes around doesn't help:
  IN: scratchpad { mdfind 'kMDItemComposer == Dylan' } utf8 [ lines ]
  with-process-reader
 
  Error
  No word named “'kMDItemComposer” found in current vocabulary search
 path
  (however, mdfind 'kMDItemComposer == Dylan' works in terminal)
 
  ---
  -Ok, so trying various permutations of single, double, triple quotes
 in
  the command:
  IN: scratchpad { mdfind kMDItemComposer == 'Dylan' } utf8 [
  lines ] with-process-reader
 
  Process exited with error code 255
  (however, mdfind kMDItemComposer == 'Dylan' works in terminal)
 
  ---
  IN: scratchpad { mdfind 'kMDItemComposer == Dylan' } utf8 [
  lines ] with-process-reader
 
  Process exited with error code 255
  (however, mdfind

Re: [Factor-talk] Factor interface to Spotlight

2013-11-09 Thread CW Alston
Great help, folks!

I think I can figure this out now. With a l'il more elbow-grease  your
pointers,
I'd like to make the 2 crutch files disappear,  access the MetaData index
in all its glory directly. That certainly would make this a much more
independent,
self-contained utility. Useful breakdown, Alex. Back to the drawing board.

Thanks, all -
~cw



On Sat, Nov 9, 2013 at 8:36 AM, John Benediktsson mrj...@gmail.com wrote:

 This works for me, it has to be a string or sequence of strings:

 IN: scratchpad { mdfind kMDItemComposer == 'Andrea Bocelli' } utf8 [
 lines ] with-process-reader

 Anyway, I love this vocab and getting it to work is like 95% of the
 challenge, I think it would be fun to modify it to not require the
 indirection and contribute it to the main repository if you're interested!

 Best,
 John.



 On Fri, Nov 8, 2013 at 10:11 PM, CW Alston cwalsto...@gmail.com wrote:

 Hi John,

 I can't get your suggestion to work with mdfind:

  Why go through the indirection of a shell script and a query results
 rather than just preparing
  a sequence of args and then grabbing all the results, e.g.
  { mdfind kMDItemAuthor == '*MyFavoriteAuthor*' } utf8 [ lines ]
 with-process-reader

 - Trying this command format (with a different MD Attribute) works fine
 in the terminal:

 ➜  ~ git:(master) ✗ mdfind kMDItemComposer == 'Dylan'
 /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/11 Wedding
 Song.m4a
 /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/10 Never
 Say Goodbye.m4a
 /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/09 You
 Angel You.m4a
 /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/08
 Dirge.m4a
 ...
 ➜  ~ git:(master) ✗

 - But trying the same command in the with-process-reader format fails in
 the listener:

 IN: scratchpad { mdfind kMDItemComposer == 'Dylan' } utf8 [ lines ]
 with-process-reader

 Process exited with error code 254

 Launch descriptor:

 T{ process
 { command { mdfind kMDItemComposer == 'Dylan' } }
 { environment H{ } }
 { environment-mode +append-environment+ }
 { stdout T{ fd { disposed t } { fd 23 } } }
 { group +same-group+ }
 { status 254 }
 { pipe
 T{ pipe
 { in T{ fd { disposed t } { fd 19 } } }
 { out T{ fd { disposed t } { fd 23 } } }
 }
 }
 }
 ---
 -Switching single  double quotes around doesn't help:
 IN: scratchpad { mdfind 'kMDItemComposer == Dylan' } utf8 [ lines ]
 with-process-reader

 Error
 No word named “'kMDItemComposer” found in current vocabulary search path
 (however, mdfind 'kMDItemComposer == Dylan' works in terminal)

 ---
 -Ok, so trying various permutations of single, double, triple quotes in
 the command:
 IN: scratchpad { mdfind kMDItemComposer == 'Dylan' } utf8 [ lines
 ] with-process-reader

 Process exited with error code 255
 (however, mdfind kMDItemComposer == 'Dylan' works in terminal)

 ---
 IN: scratchpad { mdfind 'kMDItemComposer == Dylan' } utf8 [ lines
 ] with-process-reader

 Process exited with error code 255
 (however, mdfind 'kMDItemComposer == Dylan' works in terminal)

 ---
 IN: scratchpad { mdfind 'kMDItemComposer == Dylan' } utf8 [
 lines ] with-process-reader

 Process exited with error code 1
 (again, mdfind 'kMDItemComposer == Dylan' works in terminal)

 ---
 -Using the code from the spotlight.factor vocab works like the terminal
 example above:
 IN: scratchpad Dylan by-Composer mdfind .

 {
 /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/11
 Wedding Song.m4a
 /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/10
 Never Say Goodbye.m4a
 /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/09
 You Angel You.m4a
 /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/08
 Dirge.m4a
 /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/07
 Forever Young (Continued).m4a
 /Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/06
 Forever Young.m4a
 ...
 }

 I'm probably missing something simple, but I haven't found a way to get
 mdfind to work in
 a process command, and reading the output stream-lines.
 Hence, my relief at getting a shell script and a query results approach
 to work without blowing up.

 I agree, it would be much more elegant to craft a solution in the form of
 your suggestion.
 If anyone can cook one up, that would really be sweet! I just want to
 access the Spotlight
 MetaData Index from Factor in the simplest possible way. Meanwhile, I'll
 exercise spotlight;
 baroque as it is, it gets me to the MetaData, and does find things.

 Thanks,
 Charles



 On Fri, Nov 8, 2013 at 8:37 AM, John Benediktsson mrj...@gmail.comwrote:

 Hi,

 Why go through the indirection of a shell script and a query results
 rather than just preparing a sequence of args and then grabbing all the
 results, e.g.

 { mdfind kMDItemAuthor == '*MyFavoriteAuthor

Re: [Factor-talk] Factor interface to Spotlight

2013-11-08 Thread CW Alston
P.S. - I should note that, in the posted example for mdutil -

! BUILD THIS SCRIPT:
! sudo mdutil -E-s /Volumes/Jurassic\ Grad\ -\ Spare\ Change/ 
/Users/cwalston/factor/mdquery-results.txt

! EXAMPLE:
! /Volumes/Jurassic Grad - Spare Change md-re-index

- there is an issue intercepting the authentication prompt required by
sudo. I actually got
a response after running the command-line directly in my shell, to see what
was going on...
Any suggestions as to how intercept this authentication prompt?
~cw


On Thu, Nov 7, 2013 at 11:25 PM, CW Alston cwalsto...@gmail.com wrote:

 Greetings, Factorials -

 I've posted a vocab to the pastebin, a Factor interface to OS X 
 Spotlighthttp://paste.factorcode.org/new-paste?__c=9053524212955052707
 .
 Pardon the length; this should be split into at least 2 code files 
 a docs file. Just seems best to show everything together for the post.

 The general strategy is to compose a Spotlight query as a command-line
 one-liner
 and write that to an executable shell script file; then, launch a Factor
 process
 that calls that executable. The script directs the shell output to a named
 text file, whose contents are returned to Factor as a sequence of
 file-lines.

 OS X exposes 4 commands that deal with Spotlight via its MetaData index:
 mdfind, mdls, mdutil, mdimport (see their man pages for details).
 Implementing
 mdfind was my main aim, but getting at all 4 from Factor seemed worth the
 effort.
 What a rabbit hole! I had to console myself with frequent laughter breaks
 reading
 *The Unix-Hater's Handbook* (*q.v.*). Oy!!

 To try out the code, you'll need to put a plain-text file in some
 convenient path,
 to receive query results. Also, set up an executable file somewhere; your
 command-
 line scripts will be written there. You can modify the paths to these 2
 files,
  the form of the hashbang, to suit convenience  your shell. Just be
 consistent
 with what the code expects. (Dont forget to put the pastebin code in a
 folder named
 spotlight, within your work folder, to exercise it in the listener.)

 I'd appreciate it if folks would try the examples (modifying paths 
 filenames),
 compose arbitrary queries; see what breaks, is cumbersome, impossible, or
 goofy;
 and suggest improvements or alternative approaches for working with
 Spotlight.
 Alex's suggestion of using streams seems more intuitive  direct to me,
 but I
 foundered wading those waters.

 And, yeah, I'm hip - a ridiculous plethora of string CONSTANT:s. A few are
 just composition crutches, and overkill. The majority seem to suit this
 approach.
 See what you think.

 Do take a look at the code, if you have an interest, and opine away.
 Cheers,
 CW Alston

 --
 *~ Memento Amori*




-- 
*~ Memento Amori*
--
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231iu=/4140/ostg.clktrk___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor interface to Spotlight

2013-11-08 Thread CW Alston
(Oops- forgot to sign in)
Thanks for the heads-up, Björn - try this link, folks.
~cw


On Fri, Nov 8, 2013 at 1:14 AM, CW Alston cwalsto...@gmail.com wrote:

 Thanks for the heads-up, Björn - try this 
 linkhttps://gist.github.com/anonymous/7368381
 .

 ~cw


 On Fri, Nov 8, 2013 at 12:49 AM, Björn Lindqvist bjou...@gmail.comwrote:

 2013/11/8 CW Alston cwalsto...@gmail.com:
  Greetings, Factorials -
 
  I've posted a vocab to the pastebin, a Factor interface to OS X
 Spotlight.
  Pardon the length; this should be split into at least 2 code files 
  a docs file. Just seems best to show everything together for the post.

 Check your link, it doesn't go anywhere. :) Perhaps try
 https://gist.github.com/ for long-lived pastes because they dont
 delete them after a few days.


 --
 mvh/best regards Björn Lindqvist




 --
 *~ Memento Amori*




-- 
*~ Memento Amori*
--
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231iu=/4140/ostg.clktrk___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor interface to Spotlight

2013-11-08 Thread CW Alston
Hi John,

I can't get your suggestion to work with mdfind:

 Why go through the indirection of a shell script and a query results
rather than just preparing
 a sequence of args and then grabbing all the results, e.g.
 { mdfind kMDItemAuthor == '*MyFavoriteAuthor*' } utf8 [ lines ]
with-process-reader

- Trying this command format (with a different MD Attribute) works fine in
the terminal:

➜  ~ git:(master) ✗ mdfind kMDItemComposer == 'Dylan'
/Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/11 Wedding
Song.m4a
/Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/10 Never Say
Goodbye.m4a
/Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/09 You Angel
You.m4a
/Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/08 Dirge.m4a
...
➜  ~ git:(master) ✗

- But trying the same command in the with-process-reader format fails in
the listener:

IN: scratchpad { mdfind kMDItemComposer == 'Dylan' } utf8 [ lines ]
with-process-reader

Process exited with error code 254

Launch descriptor:

T{ process
{ command { mdfind kMDItemComposer == 'Dylan' } }
{ environment H{ } }
{ environment-mode +append-environment+ }
{ stdout T{ fd { disposed t } { fd 23 } } }
{ group +same-group+ }
{ status 254 }
{ pipe
T{ pipe
{ in T{ fd { disposed t } { fd 19 } } }
{ out T{ fd { disposed t } { fd 23 } } }
}
}
}
---
-Switching single  double quotes around doesn't help:
IN: scratchpad { mdfind 'kMDItemComposer == Dylan' } utf8 [ lines ]
with-process-reader

Error
No word named “'kMDItemComposer” found in current vocabulary search path
(however, mdfind 'kMDItemComposer == Dylan' works in terminal)

---
-Ok, so trying various permutations of single, double, triple quotes in the
command:
IN: scratchpad { mdfind kMDItemComposer == 'Dylan' } utf8 [ lines ]
with-process-reader

Process exited with error code 255
(however, mdfind kMDItemComposer == 'Dylan' works in terminal)

---
IN: scratchpad { mdfind 'kMDItemComposer == Dylan' } utf8 [ lines ]
with-process-reader

Process exited with error code 255
(however, mdfind 'kMDItemComposer == Dylan' works in terminal)

---
IN: scratchpad { mdfind 'kMDItemComposer == Dylan' } utf8 [ lines
] with-process-reader

Process exited with error code 1
(again, mdfind 'kMDItemComposer == Dylan' works in terminal)

---
-Using the code from the spotlight.factor vocab works like the terminal
example above:
IN: scratchpad Dylan by-Composer mdfind .

{
/Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/11
Wedding Song.m4a
/Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/10
Never Say Goodbye.m4a
/Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/09 You
Angel You.m4a
/Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/08
Dirge.m4a
/Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/07
Forever Young (Continued).m4a
/Applications/Music/iTunes/iTunes Music/Bob Dylan/Planet Waves/06
Forever Young.m4a
...
}

I'm probably missing something simple, but I haven't found a way to get
mdfind to work in
a process command, and reading the output stream-lines.
Hence, my relief at getting a shell script and a query results approach
to work without blowing up.

I agree, it would be much more elegant to craft a solution in the form of
your suggestion.
If anyone can cook one up, that would really be sweet! I just want to
access the Spotlight
MetaData Index from Factor in the simplest possible way. Meanwhile, I'll
exercise spotlight;
baroque as it is, it gets me to the MetaData, and does find things.

Thanks,
Charles



On Fri, Nov 8, 2013 at 8:37 AM, John Benediktsson mrj...@gmail.com wrote:

 Hi,

 Why go through the indirection of a shell script and a query results
 rather than just preparing a sequence of args and then grabbing all the
 results, e.g.

 { mdfind kMDItemAuthor == '*MyFavoriteAuthor*' } utf8 [ lines ]
 with-process-reader





 On Fri, Nov 8, 2013 at 1:55 AM, CW Alston cwalsto...@gmail.com wrote:

 (Oops- forgot to sign in)
 Thanks for the heads-up, Björn - try this link, folks.
  ~cw


 On Fri, Nov 8, 2013 at 1:14 AM, CW Alston cwalsto...@gmail.com wrote:

 Thanks for the heads-up, Björn - try this 
 linkhttps://gist.github.com/anonymous/7368381
 .

 ~cw


 On Fri, Nov 8, 2013 at 12:49 AM, Björn Lindqvist bjou...@gmail.comwrote:

 2013/11/8 CW Alston cwalsto...@gmail.com:
  Greetings, Factorials -
 
  I've posted a vocab to the pastebin, a Factor interface to OS X
 Spotlight.
  Pardon the length; this should be split into at least 2 code files 
  a docs file. Just seems best to show everything together for the post.

 Check your link, it doesn't go anywhere. :) Perhaps try
 https://gist.github.com/ for long-lived pastes because they dont
 delete them after a few days.


 --
 mvh/best regards Björn Lindqvist




 --
 *~ Memento Amori*




 --
 *~ Memento Amori

[Factor-talk] Factor interface to Spotlight

2013-11-07 Thread CW Alston
Greetings, Factorials -

I've posted a vocab to the pastebin, a Factor interface to OS X
Spotlighthttp://paste.factorcode.org/new-paste?__c=9053524212955052707
.
Pardon the length; this should be split into at least 2 code files 
a docs file. Just seems best to show everything together for the post.

The general strategy is to compose a Spotlight query as a command-line
one-liner
and write that to an executable shell script file; then, launch a Factor
process
that calls that executable. The script directs the shell output to a named
text file, whose contents are returned to Factor as a sequence of
file-lines.

OS X exposes 4 commands that deal with Spotlight via its MetaData index:
mdfind, mdls, mdutil, mdimport (see their man pages for details).
Implementing
mdfind was my main aim, but getting at all 4 from Factor seemed worth the
effort.
What a rabbit hole! I had to console myself with frequent laughter breaks
reading
*The Unix-Hater's Handbook* (*q.v.*). Oy!!

To try out the code, you'll need to put a plain-text file in some
convenient path,
to receive query results. Also, set up an executable file somewhere; your
command-
line scripts will be written there. You can modify the paths to these 2
files,
 the form of the hashbang, to suit convenience  your shell. Just be
consistent
with what the code expects. (Dont forget to put the pastebin code in a
folder named
spotlight, within your work folder, to exercise it in the listener.)

I'd appreciate it if folks would try the examples (modifying paths 
filenames),
compose arbitrary queries; see what breaks, is cumbersome, impossible, or
goofy;
and suggest improvements or alternative approaches for working with
Spotlight.
Alex's suggestion of using streams seems more intuitive  direct to me, but
I
foundered wading those waters.

And, yeah, I'm hip - a ridiculous plethora of string CONSTANT:s. A few are
just composition crutches, and overkill. The majority seem to suit this
approach.
See what you think.

Do take a look at the code, if you have an interest, and opine away.
Cheers,
CW Alston

-- 
*~ Memento Amori*
--
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231iu=/4140/ostg.clktrk___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] process command conundrum

2013-10-21 Thread CW Alston
Greetings, folks -

I'm trying to compose a find-file utility that takes advantage
of Spotlight's index on the Mac (I'm running 10.6.8). A simple search
tool built on find-file from io.directories.search works, even with
space-separated filenames, e.g., Finding Joy in Combinators.pdf, but
it walks the entire hierarchy  I want to avoid that delay.
Here's that word, using locals:

:: find-file* ( filename -- path/f ) ! REALLY LONG... CAN WE USE SPOTLIGHT?
filename : this-filename
/ t [ file-name this-filename = ] find-file
;

I found a command-line incantation that does the trick in Terminal:

➜  ~ git:(master) ✗ mdfind -onlyin / 'kMDItemFSName == Finding Joy in
Combinators.pdf'

/Applications/Programming Languages/Functional Languages/Concatenative
languages/Joy (programming language) folder/Finding Joy in Combinators.pdf
➜  ~ git:(master) ✗

I can successfully send the Terminal output to a file:

➜  ~ git:(master) ✗ mdfind -onlyin / 'kMDItemFSName == Finding Joy in
Combinators.pdf'  /Users/cwalston/factor/mdfind.txt
➜  ~ git:(master) ✗

But I'm at loggerheads trying to compose a process command that does the
same from
within Factor. My latest attempt is this:

: tri-quotes-surround ( seq -- seq' )   surround ; ! goofy,
but seems to work

:: mdfind-request ( filename -- seq )
 'kMDItemFSName ==  filename tri-quotes-surround append  '
append ;

: mdfind-process ( filename -- process )
 mdfind-request! ( -- seq )
 '[ mdfind , -onlyin , / , _ ,  ,
/Users/cwalston/factor/mdfind.txt , ]
 { } make  ! ( -- seq )
  process swap command
  t detached clone  ! ( -- process )
;

And then, Finding Joy in Combinators.pdf mdfind-process contains a
command
sequence that looks like this:
{
mdfind
-onlyin
/
'kMDItemFSName == \Finding Joy in Combinators.pdf\'

/Users/cwalston/factor/mdfind.txt
}

-which I thought translates to the successful command-line phrase above:

mdfind -onlyin / 'kMDItemFSName == Finding Joy in Combinators.pdf'

But it does't produce the desired result in my word that calls
mdfind-process :

SYMBOL: file-process
SYMBOL: file-process-status
: mdfind-file ( filename -- seq )   ! Using Spotlight index
  mdfind-process  run-process
  dup file-process set  wait-for-process file-process-status set ! FOR
TESTING
  /Users/cwalston/factor/mdfind.txt utf8 file-contents
;

e.g.,
IN: scratchpad Finding Joy in Combinators.pdf mdfind-file

--- Data stack:

IN: scratchpad

Meaning, nothing is written to /Users/cwalston/factor/mdfind.txt !
Ideally, I'd rather stream the result directly to Factor, but I can't
figure that out
until I get the process command straight.

Any insights welcome! Thanks,
~Charles Alston

-- 
*~ Memento Amori*
--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60135031iu=/4140/ostg.clktrk___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] process command conundrum

2013-10-21 Thread CW Alston
Helpful suggestions! I'll work on them, and let you know what works for me.
Thanks kindly, all ~cw


On Mon, Oct 21, 2013 at 10:03 AM, John Benediktsson mrj...@gmail.comwrote:

 These are all great suggestions, when you get it working, it would be
 great if you'd contribute it!

 Best,
 John.


 On Mon, Oct 21, 2013 at 8:54 AM, Alex Vondrak ajvond...@gmail.com wrote:

 Maybe this whole thing is solved by going directly to the stream solution?

 $ rlwrap ./factor -run=listener 2 /dev/null
 IN: scratchpad USING: io.encodings.utf8 io.launcher ;
 IN: scratchpad find /home/alex/talks/factor -name *.pdf utf8 [ lines
 ] with-process-reader .
 {
 /home/alex/talks/factor/factor.pdf
 /home/alex/talks/factor/factor-test.pdf
 }
 IN: scratchpad find /home/alex/talks/factor -name DOESNOTEXIST utf8
 [ lines ] with-process-reader .
 { }
 IN: scratchpad find /proc -name PERMISSION_DENIED_ERROR utf8 [ lines
 ] with-process-reader .
 Process exited with error code 1

 Launch descriptor:

 T{ process
 { command
 find /proc -name PERMISSION_DENIED_ERROR
 }
 { environment H{ } }
 { environment-mode +append-environment+ }
 { stdout T{ fd { disposed t } { fd 19 } } }
 { group +same-group+ }
 { status 1 }
 { pipe
 T{ pipe
 { in T{ fd { disposed t } { fd 18 } } }
 { out T{ fd { disposed t } { fd 19 } } }
 }
 }
 }

 Type :help for debugging help.

 See
 -
 http://docs.factorcode.org/content/word-with-process-reader%2Cio.launcher.html
 - http://docs.factorcode.org/content/word-lines,io.html
 - General perusal of
 http://docs.factorcode.org/content/article-io.launcher.html and
 http://docs.factorcode.org/content/vocab-io.launcher.html

 As for the original problem of I/O redirection, there seem to be some
 docs on that at
 http://docs.factorcode.org/content/article-io.launcher.redirection.html
 and some examples in
 http://docs.factorcode.org/content/article-io.launcher.examples.html

 Hope that helps,
 --Alex Vondrak

 On Mon, Oct 21, 2013 at 2:26 AM, Björn Lindqvist bjou...@gmail.com
 wrote:
  2013/10/21 CW Alston cwalsto...@gmail.com:
  :: mdfind-request ( filename -- seq )
   'kMDItemFSName ==  filename tri-quotes-surround append  '
  append ;
 
  : mdfind-process ( filename -- process )
   mdfind-request! ( -- seq )
   '[ mdfind , -onlyin , / , _ ,  ,
  /Users/cwalston/factor/mdfind.txt , ]
   { } make  ! ( -- seq )
process swap command
t detached clone  ! ( -- process )
  ;
 
  And then, Finding Joy in Combinators.pdf mdfind-process contains a
  command
  sequence that looks like this:
  {
  mdfind
  -onlyin
  /
  'kMDItemFSName == \Finding Joy in Combinators.pdf\'
  
  /Users/cwalston/factor/mdfind.txt
  }
 
  The command attribute in process should be a string not a sequence
  of strings. I think that is the core of your problem, not sure. Also,
  input and output redirection is a feature of the shell, not the os, so
  you need to wrap those commands in a subshell. But that is platform
  dependent since not all shells are available everywhere and they dont
  all have the same features. Here is how you could write a find utility
  for Windows (using gnu find), maybe you can use it as a template:
 
  USING: formatting io.launcher kernel ;
  IN: cmdpipe
 
  CONSTANT: find-bin C:\\Program Files (x86)\\Git\\bin\\find.exe
 
  : shell-command ( str -- str' )
  cmd /C \%s\ sprintf ;
 
  : find-command ( dir pattern out-path -- str )
  [ find-bin ] 3dip \%s\ \%s\ -name \%s\  \%s\ sprintf ;
 
  : run-find ( dir pattern out-path -- proc )
  find-command shell-command run-process ;
 
  IN: scratchpad C:\\Users\\bjourne\\Downloads *.pdf
  C:\\Users\\bjourne\\result.txt run-find
 
 
  --
  mvh/best regards Björn Lindqvist
 
 
 --
  October Webinars: Code for Performance
  Free Intel webinars can help you accelerate application performance.
  Explore tips for MPI, OpenMP, advanced profiling, and more. Get the
 most from
  the latest Intel processors and coprocessors. See abstracts and
 register 
 
 http://pubads.g.doubleclick.net/gampad/clk?id=60135031iu=/4140/ostg.clktrk
  ___
  Factor-talk mailing list
  Factor-talk@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/factor-talk


 --
 October Webinars: Code for Performance
 Free Intel webinars can help you accelerate application performance.
 Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most
 from
 the latest Intel processors and coprocessors. See abstracts and register 

 http://pubads.g.doubleclick.net/gampad/clk?id=60135031iu=/4140/ostg.clktrk
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists

Re: [Factor-talk] Confused about run-pipeline

2013-04-25 Thread CW Alston
Hi Alex - just saw this. Thanks much; your example unclogs my confusion on
pipes nicely!
Onward ~cw


On Mon, Apr 22, 2013 at 3:06 PM, Alex Vondrak ajvond...@gmail.com wrote:

 Well, there's your problem: you don't want `run-pipeline` at all.  :)

   IN: scratchpad echo \Hi\ run-detached my-process set-global
   IN: scratchpad my-process get-global .
   T{ process
   { command echo \Hi\ }
   { environment H{ } }
   { environment-mode +append-environment+ }
   { group +same-group+ }
   { status 0 }
   }

 `run-pipeline` is like a series of Unix pipes.  So,


   { cat log.txt grep error sort uniq } run-pipeline

 is like typing


   $ cat log.txt | grep error | sort | uniq

 at a bash prompt.  Except not every element of the pipeline has to be a
 process descriptor---you can insert Factor code along the way.

 Roughly, it works by sequentially calling `run-pipeline-element` on each
 item in your sequence.  `run-pipeline-element` is defined by:

   IN: scratchpad \ run-pipeline-element see-methods
   USING: combinators destructors io io.pipes.private kernel
   quotations ;
   M: callable run-pipeline-element
   [
   [ [ ?reader ] [ ?writer ] bi* ] dip
   [ ( -- result ) call-effect ] curry with-streams*
   ] with-destructors ;

   USING: accessors destructors io.launcher io.pipes.private kernel
   ;
   M: object run-pipeline-element
   [ process swap stdout swap stdin run-detached ]
   [ drop [ [ dispose ] when* ] bi@ ] 3bi wait-for-process ;

 I.e., it's already calling `run-detached` on anything in the pipeline
 that's just a process description.  Otherwise, it expects a quotation that
 takes no inputs, produces one output, and then calls that quotation with
 the I/O streams rebound.  E.g.,

   IN: scratchpad { cat /tmp/patch [ readln string ] } run-pipeline .
   {
   0
   diff --git a/basis/prettyprint/prettyprint-tests.factor
 b/basis/prettyprint/prettyprint-tests.factor
   }

 We see that the result of the first item in the pipeline is 0 (the exit
 code of cat), and the result of the second item in the pipeline the output
 from the Factor quotation, which it read from standard-input.  Except that
 standard-input was bound to the output of the prior pipeline element (the
 output of cat).

 Hope that helps,
 --Alex Vondrak




-- 
*~ Memento Amori*
--
Try New Relic Now  We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app,  servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Confused about run-pipeline

2013-04-22 Thread CW Alston
Factor folks -


I'm missing something trying to properly set up the components

of a sequence to be passed to run-pipeline. I intend the components

to be:

(1) a process launch descriptor, with stack effect ( -- desc ) ;

(2) a quotation composed only of run-detached, stack effect ( desc --
process ) ;

(3) a quotation to store the proc in a variable,  stack effect ( process --
);

-these followed by quotations of words with stack effect ( -- ),

all duly wrapped in a sequence { … }.


The word description for run-pipeline says that run-pipeline:

Creates a pipe between each pipeline component, with the output of each
component becoming the input of the next.


The first component reads input from input-stream and the last component
writes output to output-stream.


Each component runs in its own thread, and the word returns when all
components finish executing. Each component outputs a result value.


My sundry attempts to meet these requirements typically result in a

data stack underflow on execution, or an aberrant stack effect during
compile.


Can anyone sketch a proper set-up for generic requirements like mine,

to successfully pass a component sequence to run-pipeline?


Thanks for any suggestions,

~cw


-- 
*~ Memento Amori*
--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis  visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Confused about run-pipeline

2013-04-22 Thread CW Alston
Hi -


Yes, indeed, the run-pipeline example works fine, composed

of strings of unix commands. My components are Factor callable

quotations and a launch descriptor:


SYMBOL: my-process

{

  my-process   ! ( -- desc )

  [ run-detached ]! ( -- process )

  [ my-process set-global t ]   ! ( -- t )

}

run-pipeline


Calling run-pipeline on the sequence fails with:


Error in thread 341 (Future, [ ~slice~ ~quotation~ ~quotation~ dip
run-pipeline-element...):

Data stack underflow


Note that the phrase my-process run-detached my-process set-global t

completes successfully in the listener. Also, the code compiles without
error in its

compilation unit.


I can step down through the code as far as the word map! successfully.
However,

trying to set a breakpoint on map! hangs the system, so I can't follow into
that word.

I added the boolean at the end to satisfy the requirement that each
component

must output a single value. I can't see how that alone would produce the
stack

underflow.


Since the vocabulary description for run-pipeline reads:


Pipeline components must be one of the following:

• A quotation. The quotation is called with both input-stream and
output-stream   rebound, except for the first and last pipeline components,
and it must output a single value.

• A process launch descriptor. See Launch descriptors. ,


I suspect my problem is in the binding of the input/output streams. I'll
experiment

with that, but do let me know if I'm missing something simple. I just want
to find

out how to properly use run-pipeline with ordinary callables, especially
quotations

composed of words with stack effect ( -- ).


Thanks for the replies.

~cw



On Mon, Apr 22, 2013 at 6:20 AM, John Benediktsson mrj...@gmail.com wrote:

 The example is simple and works fine:

 { cat log.txt grep error sort uniq } run-pipeline

 Can you explain the more complicated thing you're trying to do?


 On Mon, Apr 22, 2013 at 4:30 AM, CW Alston cwalsto...@gmail.com wrote:

 Factor folks -


 I'm missing something trying to properly set up the components

 of a sequence to be passed to run-pipeline. I intend the components

 to be:

 (1) a process launch descriptor, with stack effect ( -- desc ) ;

 (2) a quotation composed only of run-detached, stack effect ( desc --
 process ) ;

 (3) a quotation to store the proc in a variable,  stack effect ( process
 -- );

 -these followed by quotations of words with stack effect ( -- ),

 all duly wrapped in a sequence { … }.


 The word description for run-pipeline says that run-pipeline:

 Creates a pipe between each pipeline component, with the output of each
 component becoming the input of the next.


 The first component reads input from input-stream and the last component
 writes output to output-stream.


 Each component runs in its own thread, and the word returns when all
 components finish executing. Each component outputs a result value.


 My sundry attempts to meet these requirements typically result in a

 data stack underflow on execution, or an aberrant stack effect during
 compile.


 Can anyone sketch a proper set-up for generic requirements like mine,

 to successfully pass a component sequence to run-pipeline?


 Thanks for any suggestions,

 ~cw


 --
 *~ Memento Amori*


 --
 Precog is a next-generation analytics platform capable of advanced
 analytics on semi-structured data. The platform includes APIs for building
 apps and a phenomenal toolset for data science. Developers can use
 our toolset for easy data analysis  visualization. Get a free account!
 http://www2.precog.com/precogplatform/slashdotnewsletter
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk





-- 
*~ Memento Amori*
--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis  visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Directed graph queries via closure?

2013-03-24 Thread CW Alston
Greetings folks -


I'm experimenting with directed graph possibilites over an inverted index
(of terms in files)

that I've designed. I'm stumbling on the use of the word closure defined
IN: graphs,

using hashtables:


USING: graphs.private kernel ;

IN: graphs

: closure ( obj quot -- assoc )

H{ } clone [ swap (closure) ] keep ; inline


The article on 'Directed graph utilities' suggests that:


You can perform queries on the graph:

 closure ( obj quot -- assoc )


Directed graphs are used to maintain cross-referencing information for
Definitions.


I want to implement just such cross-referencing  querying with my inverted
index graph.

It seems there are no example usages of the graphs-vocab closure, but there
is a dopplegänger

definition of closure IN: classes.private, which appears to do the same
work using hash-sets:


USING: kernel ;

IN: classes.private

: closure ( obj quot -- set )

HS{ } clone [ swap (closure) ] keep ; inline


I find the only(?) example use of the classes.private closure is in the
definition of class-usages,

which is opaque to me. I can't suss out what the construction
sets:membersthere is doing.

Although the recursive (closure) in its def has an obvious analogue in
graph's (closure), both

are a mite hairy.


Can anyone soothe my perplexity with an illustration using closure on a
directed graph?

Much obliged,

~cw
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Left-over bug in editors.textmate fix

2013-03-07 Thread CW Alston
Hi John - my $PATH starts off with that in .zshrc (z-shell):

export
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/cwalston/factor:..

and was set up like that ever since I started out with Factor. Elie's
suggestion implies
that process commands require an explicit absolute path, and that
substitution does
solve the problem nicely. Am I missing a shortcut, that would obviate the
need for
an absolute path? Anyone else tripped over this?

I'm particularly interested, because I'm trying to reference Factor as an
attachment in
a distributed couchDB application - an 'embedded' scripting language
document, callable
via processes or executable images over, e.g., HTTP. For instance, I have a
word for
triggering replication which times out over anything but a fast network
connection:

: localhostcloudant ( -- assoc ) *! CLOUDANT ON 1.0.2 DOESN'T WORK, USE
curl*
H{
 { source http://username:password@localhost:5984/tcm-herbarium;
}
 { target http://username:password@
cloudant.com:5984/tcm-herbarium }
 } json-post-data http://localhost:5984/_replicate; couch-post* ;

But I can always succeed with replication via curl in the terminal:

*! replicate local database to cloudant:*
*!* curl http://localhost:5984/_replicate -H
'Content-Type:application/json' -d '{ source:
http://username:password@127.0.0.1:5984/tcm-herbarium,target:;
http://username:passw...@cwalston.cloudant.com/tcm-herbarium; }'

So a workable format for wrapping this in a process command would be a boon.
Anywho, let me know if I'm missing something about launching processes, or
other comments,and
thanks much,
~cw

On Wed, Mar 6, 2013 at 4:04 PM, John Benediktsson mrj...@gmail.com wrote:

 You might want to add /usr/local/bin to your $PATH, which would also fix
 it I suspect?


 On Wed, Mar 6, 2013 at 3:38 PM, CW Alston cwalsto...@gmail.com wrote:

 Greetings all -


 I finally tracked down a confusing glitch affecting my

 integrated Textmate editor functions (I'm running a

 recent .95 build). The problem: entering, e.g.,

  \ see edit

 (or any word) in the listener always failed thus --

 =

 Process exited with error code 255


 Launch descriptor:


 T{ process

 { command

 {

 mate

 -a

 -l

 20

 /Users/cwalston/factor/basis/see/see.factor

 }

 }

 { detached t }

 { environment H{ } }

 { environment-mode +append-environment+ }

 { group +same-group+ }

 { status 255 }

 }

 =

 The fix: I came across this quote in a 2007 blog by Eli 
 Chaftarihttp://www.google.com/url?sa=trct=jq=Getting+Started+with+Factor+-+Easy+FFIsource=webcd=1ved=0CDIQFjAAurl=http%3A%2F%2Ffun-factor.blogspot.com%2F2007%2F10%2Fgetting-started-with-factor-easy-ffi.htmlei=dM83UY3xEcmf2QWL8IDwAwusg=AFQjCNHkweS0gwyTcl6PsNKqTJ5yJ73sawsig2=BES6jIT1tpWLlmP3snoOHwbvm=bv.43287494,d.b2I--


 You can at any point edit a specific word inside Factor with

 \ word edit. This will pop-up the file containing that word in

 TextMate with the edit cursor positioned at the beginning of the

 line where the word is defined. You need to modify line 7 in

 extra/editors/textmate/textmate.factor replacing mate -a -l 

 with whatever the which mate command gives you as a location

 in your terminal (e.g. /usr/bin/mate -a -l ), for this to work

 in Factor version 0.9 (it has been corrected in the upcoming

 version).


 I took a look at textmate.factor (which is now in basis/editors/textmate)

 and saw that the editor-command method still reads:


 M: textmate editor-command ( file line -- command )

  [ mate , -a , -l , numberstring , , ] { } make ;



 Replacing mate with /usr/local/bin/mate (output from *which mate* in

 my terminal),

   [ /usr/local/bin/mate , -a , -l , numberstring , , ] { }
 make

  reloading as Eli had suggested, did indeed resolve the

 process failure in both the listener  the browser resource: files. Yay!

 Haven't checked the process command in other editors or elsewhere

 involving launcher commands, but that's probably a good idea.


 Perhaps this omission is specific to my particular build:


 git clone https://github.com/slavapestov/factor.git  cd factor 
 ./build-support/factor.sh update

 (can't bring up a .dmg on my 32-bit system), but it would be good to
 check out.

 Cheers! ~cw


 --
 *~ Memento Amori*

 --
 Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
 Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the
 endpoint security space. For insight on selecting the right partner to
 tackle endpoint security challenges, access the full report.
 http://p.sf.net/sfu/symantec-dev2dev
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk





-- 
*~ Memento Amori

Re: [Factor-talk] callbacks in Factor?

2013-02-19 Thread CW Alston
Hi John -

Yes, the commit you point to (Big web framework refactoring of 2008)
seems to be the the historical moment when the callbacks vocab was
moved from extra/furnace/callbacks/ to unmaintained/:

*13 * extra/furnace/callbacks/callbacks.factor →
unmaintained/cont-responder/callbacks.factor
But I'm trying to understand just why the callback code was sidelined.

Note that I'm running OS X 10.6.8,  thus grabbed the 7 February build with:

git clone https://github.com/slavapestov/factor.git  cd factor 
./build-support/factor.sh update
So I have the unmaintained directory in my Factor. The source for callbacks
is now there, in unmaintained/cont-responder/, although the preamble of
callbacks.factor
still places it IN: furnace.callbacks.

Question is, did the callbacks code break in the framework refactoring, or
is it deprecated
for security reasons (ergo the the admonition Factor source files should
not be executable)?
Or should callbacks not be used in responders for some other reason, e.g.,
callcc1 in responders
considered harmful? Or does the callbacks vocab just need more work to
integrate it back
into the updated Furnace framework?

I do find a reference to a Factor cont-responder using callcc0/1 in a 2004
post by Chris Double http://double.co.nz/factor/cont-responder.factor.
Is there some connection with this old work and the current state of the
Furnace framework?

Interesting. Puzzling! Any insights welcome.
Thanks,
~cw

On Tue, Feb 19, 2013 at 6:20 AM, John Benediktsson mrj...@gmail.com wrote:

 Hi cw,

 I think that isn't the right commit to look at -- all it did was chmod -x
 *.factor.

 The right commit is probably this one which created the file:


 https://github.com/slavapestov/factor/commit/9bd38767ab4b61d24d46bf9f2ca5a2a9a58ccd79




 On Mon, Feb 18, 2013 at 11:42 PM, CW Alston cwalsto...@gmail.com wrote:

 Hi Factoristas -

 Pursuing my interest in Factor's continuations capabilities, I'm checking
 out
 the callbacks vocabulary. On github I see that callbacks.factor has been
 moved
 out of the source tree, from furnace.callbacks into
 /unmaintained/cont-responder/,
 with the admonition Factor source files should not be executable. Can
 anyone
 lay out the issues standing in the way here?

 Thanks kindly,
 ~cw
 --
 *~ Memento Amori*


 --
 Everyone hates slow websites. So do we.
 Make your web apps faster with AppDynamics
 Download AppDynamics Lite for free today:
 http://p.sf.net/sfu/appdyn_d2d_feb
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk





-- 
*~ Memento Amori*
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] callbacks in Factor?

2013-02-19 Thread CW Alston
Hi Chris -

Oh, I see. I didn't grasp what 'conversation' and 'asides' were really up
to! I'll turn
my attention there. Furnace is gonna take a while to absorb; so many moving
parts!

Onward. Thanks!
~cw

On Tue, Feb 19, 2013 at 3:53 PM, Chris Double chris.dou...@double.co.nzwrote:

 On Wed, Feb 20, 2013 at 12:45 PM, CW Alston cwalsto...@gmail.com wrote:
 
  Interesting. Puzzling! Any insights welcome.

 IIRC It was deprecated because the new Furnace framework provided the
 same functionality in the 'asides' and 'conversation' features. There
 seemed no point maintaining two frameworks.

 Chris.
 --
 http://www.bluishcoder.co.nz




-- 
*~ Memento Amori*
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] callbacks in Factor?

2013-02-18 Thread CW Alston
Hi Factoristas -

Pursuing my interest in Factor's continuations capabilities, I'm checking
out
the callbacks vocabulary. On github I see that callbacks.factor has been
moved
out of the source tree, from furnace.callbacks into
/unmaintained/cont-responder/,
with the admonition Factor source files should not be executable. Can
anyone
lay out the issues standing in the way here?

Thanks kindly,
~cw
-- 
*~ Memento Amori*
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] continuations and Factor's Furnace?

2013-02-13 Thread CW Alston
Greetings!

Factor's Furnace framework seems poised to support 'continuation-based' web
development http://en.wikipedia.org/wiki/Continuation,
in the manner of Smalltalk's Seaside http://seaside.st/ or Racket
Schemehttp://docs.racket-lang.org/web-server/index.html.
These latter frameworks capture
and serialize current continuations to provide high-level programmatic
interaction between browsers
and servers. A little digging through old 'concatenative' posts, and I
discover a 2004 exchange
betweenhttp://tech.groups.yahoo.com/group/concatenative/message/1841
Slava  Chris D.http://tech.groups.yahoo.com/group/concatenative/message/1841,
on the possibility of such continuation-based web development being
supported
in Factor as well.

Have folks done any further work in this direction? I've been messing
around with attempts to serialize
continuations cleanly in Factor, for possible use in web programming, but
haven't discovered a
straightforward idiom to accomplish this. Marshaling continuations in  out
of json (for a couchdb-backed
web app) is what I'm aiming for. Has the implementation moved closer to
such functionality, or away from it?
I do see the words exit-with and with-exit-continuation defined in
furnace.utilities; just gotta figure out
how to leverage them!

Continuation-based web development seems a natural fit for Factor, unless
I'm missing some fundamental obstacle.

Lovin' Factor - Happy Valentine's Day!
CW Alston
-- 
*~ Memento Amori*
--
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] What a tangled webapp I weave

2013-01-05 Thread CW Alston
Greetings, all -
Experiencing the wonder of webapp development, I've managed
to bring up Congratulations, you are now running your very own Wiki
on the Front Page from the code in /extra/webapps/wiki. But clicking the
proffered
'*Edit*' link returns a dread Response error at
http://127.0.0.1:8080/edit/Front%20Page,
and elsewhere.
The new code that gets me this far is the following (run in the Listener):
---
USE: my-wiki
USE: my-wiki-run
run-wiki

*(the latter being:)*

USING: accessors db db.sqlite db.tuples furnace.alloy
furnace.db http.server io.files io.files.temp kernel
my-wiki namespaces threads ;
IN: my-wiki-run

: with-wiki-db ( quot -- )
wiki.db sqlite-db swap with-db ; inline

: run-wiki ( -- )
[ { article revision } ensure-tables ] with-wiki-db
[ init-wiki ] with-wiki-db
wiki
wiki.db sqlite-db alloy
main-responder set-global [ 8080 httpd drop ] in-thread ;
---
I've gone cross-eyed with various permutations on this theme, to no avail;
time to ask for a less blood-shot view, as I'm now seeing double.
(N.B. -- 'my-wiki' is just /extra/webapps/wiki copied to factor/work for
convenience).
Suggestions? Poultices?

Happy New Year!
CW Alston




-- 
*~ Memento Amori*
--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] glitch in smtp/mail/ui, redux

2012-09-28 Thread CW Alston
Greetings, Factoristas - (Slimmed-down revision of earlier bloated post)


Found a small bug in smtp.factor, and suggest a fix.


I ran into a glitch trying out the mail-ui vocab, from the recent Re:
Factor blog (mrjbq7-re-factor-ac166fe).

I did note the necessity of setting up SMTP to use gmail, though I couldn't
get that to happen via

.factor-boot-rc. Instead, I just added the set-up code to mail-ui.factor,
to be called from the

top-level word, open-compose-window:

--

USING: smtp namespaces io.sockets ;


: setup-smtp ( -- )

cwalsto...@gmail.com mail-password plain-auth smtp-auth set-global


smtp.gmail.com 587 inet smtp-server set-global


t smtp-tls? set-global ;

---

~So far, so good.  The 'compose' window comes up and accepts text just fine.

But clicking the 'send' button throws this error:


Generic word aux does not define a method for the byte-array class.

 Dispatching on object: B{ 65 85 84 72 32 80 76 65 73 78 32 65 71 78 51 ~36
more~ }


~Error occurs where the slot accessor aux  fails on the base64 auth
byte-array, looking for

a string instead. So, I made a small change to the send-auth method of
plain-auth in smtp.factor

to output a string rather than a byte-array and succeeded in a soliloquy
with my gmail account:

---

M: plain-auth send-auth

[ username ] [ password ] bi

plain-auth-string

!AUTH PLAIN  prepend command get-ok  ---*CHANGED TO*:

   * AUTH PLAIN   prepend-as*  command get-ok ;

---

~Now I've got mail!


Cheers,

~cw

-- 
*~ Memento Amori*
--
How fast is your code?
3 out of 4 devs don\\\'t know how their code performs in production.
Find out how slow your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219672;13503038;z?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] mrjbq7's thesaurus

2012-09-18 Thread CW Alston
Greetings -

I'm trying to suss out the structure of the binary encoded
*thesaurus.dat*file that accompanies
the *thesaurus.factor* code in *mrjbq7-re-factor-ac166fe*.
It seems very compact, and I want to adapt its word/related words format
into a concordance
for use in full-text search. Can anyone (John B, perhaps) provide a brief
sketch of the
thesaurus.dat file layout, and maybe outline a process of writing to such a
file in Factor?
I haven't been able to reverse-engineer it properly.

Any pointers much appreciated!
~Charles Alston

-- 
*~ Memento Amori*
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor 0.95 now available

2012-08-17 Thread CW Alston
Hi - Success!
I moved the old .factor files out of the way, scrapped the first try Factor
.95 folder,
re-ran the git one-liner and the fresh factor.app brought up the listener
with no errors.
The contents of the Factor folder built from git sports the following items
not appearing in
the .95 binary Factor folder:

-files: boot.unix-x86.32.image, factor.image.fresh, GNUmakeile, Nmakefile;

-folders: build-support, unmaintained, vm


I don't know if they are necessary, so I'm not gonna touch them while I
check my .94 project code compatibility.

Any thoughts on the differences? I'll keep you posted, if anything
unrecoverable pops up.

Thanks so much to all for your work. Onward!

~cw


On Fri, Aug 17, 2012 at 8:01 AM, Aaron Olson airol...@gmail.com wrote:

 +1

 This is terrific news at the end of a crappy week!

 -Aaron


 On Fri, Aug 17, 2012 at 3:54 AM, Dominikus Herzberg 
 dominikus.herzb...@gmail.com wrote:

 Congratulations for the release! Fantastic work!

 Regards,

 Dominikus

 2012/8/17 John Benediktsson mrj...@gmail.com:
  The reports of my death are greatly exaggerated - Mark Twain
 
  I'm very pleased to announce the release of Factor 0.95!  You can
  find download links on the Factor website:
 
  http://factorcode.org
 
  This release is brought to you with over 2,500 commits by the following
  individuals:
 
  Alex Vondrak, Alfredo Beaumont, Andrew Pennebaker, Anton Gorenko,
  Brennan Cheung, Chris Double, Daniel Ehrenberg, Doug Coleman, Eric
  Charlebois, Eungju Park, Hugo Schmitt, Joe Groff, John Benediktsson,
  Jon Harper, Keita Haga, Maximilian Lupke, Philip Searle, Philipp
  Brüschweiler, Rupert Swarbrick, Sascha Matzke, Slava Pestov,
  @8byte-jose, @yac, @otoburb, @rien
 
  In addition to lots (and lots!) of bug fixes and improvements, I want to
  highlight the following features:
 
  * GTK-based UI backend
  * Native image loaders using Cocoa, GTK, and GDI+
  * Sampling profiler replacing counting profiler
  * Code coverage tool to improve unit tests
  * VM and application-level signal handlers
  * ICMP support and an IPv4 ping implementation
  * DNS client and host implementation
  * Support frexp and log of really big numbers
  * Cross-platform open URL in webbrowser
  * Cross-platform send file to trash
  * Speedup bignum GCD and ratio operations
  * Speedup in thread yield performance on Mac OS X
  * CSV library is 3x faster
  * XML library is 2x faster
  * JSON library is 2-3x faster
  * Many documentation improvements
  * Many stability and performance enhancements
 
  Some possible backwards compatibility issues:
 
  * Change alien references from int to int ref and *int to
 int deref
  * Removed Windows CE, BSD, and Solaris platform support
  * Natively support binary (0b), octal (0o), and hexadecimal (0x) number
 syntax
  * Unify ( -- ) and (( -- )) stack effect syntax
  * Change prepend to return type of first sequence to match append
 behavior
  * Change .factor-rc to be .factor-rc on all platforms
  * Cleanup specialized array syntax to be more generic and consistent
  * Change to quadratic probing instead of linear probing in hashtables
  * Allow dispatching on anonymous intersections/unions
 
  For more details, please see the full announcement at:
 
  http://re-factor.blogspot.com/2012/08/factor-095-now-available.html
 
 
 --
  Live Security Virtual Conference
  Exclusive live event will cover all the ways today's security and
  threat landscape has changed and how IT managers can respond.
 Discussions
  will include endpoint security, mobile security and the latest in
 malware
  threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
  ___
  Factor-talk mailing list
  Factor-talk@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/factor-talk


 --
 Live Security Virtual Conference
 Exclusive live event will cover all the ways today's security and
 threat landscape has changed and how IT managers can respond. Discussions
 will include endpoint security, mobile security and the latest in malware
 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk




 --
 Live Security Virtual Conference
 Exclusive live event will cover all the ways today's security and
 threat landscape has changed and how IT managers can respond. Discussions
 will include endpoint security, mobile security and the latest in malware
 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
 ___
 Factor-talk mailing list
 

Re: [Factor-talk] Factor 0.95 now available

2012-08-17 Thread CW Alston
Gracias, John -

Comforting to know what's up. Any ideas on what prevents the .95 binary
from launching on my aged machine? First time I've encountered this problem.
I've successfully launched from incremental development releases through
July.
~cw


On Fri, Aug 17, 2012 at 12:45 PM, John Benediktsson mrj...@gmail.comwrote:

 The contents of the Factor folder built from git sports the following
 items not appearing in
 the .95 binary Factor folder:

 -files: boot.unix-x86.32.image, factor.image.fresh, GNUmakeile, Nmakefile;


 These are:

 1) boot image downloaded to create a complete factor image file for your
 platform (32-bit unix).
 2) copy of the factor.image file to allow reverting if you want to have
 a clean environment
 3) make file to build on unix platforms
 4) make file to build on windows


 -folders: build-support, unmaintained, vm


 5) a directory with build it, scotty files for all platforms.
 6) a directory with not working but maybe in the future code
 7) a directory with C++ code for the VM that produces the ./factor binary



 I don't know if they are necessary, so I'm not gonna touch them while I
 check my .94 project code compatibility.

 Any thoughts on the differences? I'll keep you posted, if anything
 unrecoverable pops up.

 Thanks so much to all for your work. Onward!


 Glad it works for you, these files are not released in the binary releases
 but all contain or are related to the source build process.

 Best!
 John.




-- 
*~ Memento Amori*
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor 0.95 now available

2012-08-17 Thread CW Alston
Okey-dokey, keep on keepin' on. More later, as need arises.
~cw

On Fri, Aug 17, 2012 at 1:17 PM, John Benediktsson mrj...@gmail.com wrote:

 Gracias, John -


 De nada ;)


 Comforting to know what's up. Any ideas on what prevents the .95 binary
 from launching on my aged machine? First time I've encountered this
 problem.
 I've successfully launched from incremental development releases through
 July.


 Likely related to upgrading to Mac OS X 10.8 and XCode 4.4 on the build
 farm.  It wasn't intentional, but we're trying to figure out if we can make
 XCode 4.4 build against 10.6 SDK or downgrade to a configuration that will
 work properly... once we get it working we can make new binaries...

 Best,
 John.




-- 
*~ Memento Amori*
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] ternary-search-tries confusion

2011-12-11 Thread CW Alston
Greetings, Factorials -
I've been working through mrjbq7's re-factor utilities, particularly a pet
interest of mine, ternary search trees.
Thrilled to see an implementation in Factor, but I can't get the code to
compile. Here's the error I get with
*USE: ternary-search-trees* in the listener:

*resource:work/ternary-search-trees/ternary-search-trees.factor*
*
*
* 9: *
*12: *
*  ^*
*The word define-maybe cannot be executed because it failed to compile*
*
*
*The input quotations to “if” don't match their expected effects*
*InputExpected
  Got*
*[ ~quotation~ ~quotation~ make define-inline ] (( ..a -- ..b )) (( x x --
))*
*[ 2drop ](( ..a --
..b )) (( x -- ))*


'*define-maybe*' is in the required file, *accessors.maybe* -- I planted
all code in the 'work' directory of factor.
The untouched code there reads:
-
*USING: accessors arrays kernel make quotations sequences*
*slots words ;*
*
*
*IN: accessors.maybe*
*
*
*: maybe-word ( name -- word )*
*maybe- prepend accessors create ;*
*
*
*: define-maybe ( name -- )*
*dup maybe-word dup deferred? [*
*[*
*over setter-word \ drop 2array quotation*
*[ keep ] curry , \ compose ,*
*swap reader-word [ dup ] swap 1quotation compose*
*[ [ nip ] ] compose , \ dip , \ if* ,*
*] [ ] make ( object quot: ( -- x ) -- value ) define-inline*
*] [ 2drop ] if ;*
*
*
*: define-maybe-accessors ( class -- )*
*slots word-prop [*
*dup read-only [ drop ] [ name define-maybe ] if*
*] each ;*
-

I just can't untangle the stack effects in '*define-maybe*' to see where
the stack is disrupted. Any insights from folks
better initiated? Note that:
---
 *9: *
*12: *
*  ^*
---
in the error output (lines 9-12) points to:
---
**
*TUPLE: tree-node ch value exists lt eq gt ;*
*tree-node define-maybe-accessors*
**
---
in file 'ternary-search-trees.factor' .

Thanks, all, and keep up the good work,
CW Alston
-- 
*~ Memento Amori*
--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk