Hi Jon,

On 2016-11-07 22:34, Jon Harper wrote:
> Hi Peter,
> 
> On Mon, Nov 7, 2016 at 3:07 PM, <pet...@riseup.net> wrote:
> 
>> Hello,
>> 
>> I am tinkering with factor and was wondering if it is OK to pick your
>> brains here? As I play around with the language questions come up that
>> are probably easy for you to answer. I don't see much action on the
>> #concatenative IRC channel so I thought the maling list might be a
>> better place?
>> 
>> Questions are always welcome. The mailing list or #concatenative on 
>> IRC
> are both good places to ask. Several people read the logs of 
> #concatenative
> and may answer your questions some time after you sent it, so don't 
> give up.

In that case I guess the mailing list makes more sense. Unless there's 
people reading the IRC logs and not part of the mailing list.

> 
> As a starter:
>> 
>> - I see a common pattern in definitions of using `dip` instead of
>> `swap`. Is there some special reason for that? Is it more performant? 
>> I
>> know the words aren't interchangeable but e.g. `with-directory-files`
>> has `[ [ "" directory-files ] ] dip` which as far as I can tell is
>> equivalent to `[ "" directory-files ] swap`. I saw this pattern in 
>> more
>> definitions.
>> 
> I guess it's a matter of personal style. I would argue that the 
> 'meaning'
> of swap ( x y -- y x ) is that there's the same importance on pushing y
> down the stack than on puling x up the stack. Whereas [ y ] dip would 
> focus
> more putting y down the stack.
> 
> Regarding the performance, you can often see for yourself using the
> optimized. word of compiler.tree.debugger. You could even install 
> libudis
> and use the disassemble word of tools.disassembler.
> I would be surprised if the performance of swap vs dip mattered in a 
> real
> application.
> 

Thanks, I guess your explanation makes sense, `[ y ] dip` looked a bit 
weird to me on the first look but I understand the meaning now.

> 
>> 
>> - is there any sequence generator/iterator vocabulary? Something that
>> gives or computes values on demand. One can find it in many languages
>> with a bit different flavor, e.g. Scheme, Rust, Python. I saw that 
>> there
>> is lists.lazy which can serve a similar purpose but is a bit more 
>> heavy
>> weight in some cases. Maybe this isn't needed in factor at all and you
>> use a different pattern to solve a similar problem?
>> 
> I've seen discussions on this mailing list about the extra/cursors
> vocabulary about that. I've never used it though. For example Joe 
> talked
> about it in 2009: 
> https://sourceforge.net/p/factor/mailman/message/23878123
> 

I see, so nothing that would be alive.



In the meantime I finished a small script where I was trying out factor 
- it goes into my git folders and fetches/pulls updates from origin. I 
got the first version working pretty quickly, then I wanted to tweak it 
so that the updates run in parallel and output updates on the console 
live. In a final version I wanted to print some progressbar while 
surpressing git output. For that reason I thought I need message 
passing. This isn't working as I expect it to. Here is the gist:

https://gist.github.com/xificurC/f4de1993b3218a50dd8936dfc0ec16f2

There are my last 2 attemps. The first, commented out version finishes 
without waiting for the threads to finish (even with the ugly hack of 
reading the state>> of the thread) while in the second the receiving 
thread doesn't read the messages as they arrive, rather its mailbox gets 
filled up and only when everyone finishes gets time to work on the 
messages. What am I doing wrong?

On the topic of factor's cooperative threads - do they run multi- or 
single-core?

If you have some other tips on the code I'll be glad, I feel like I'm 
doing more shuffling then I might need.

Thank you for your answer.

> Cheers,
> Jon
> 
> ------------------------------------------------------------------------------
> Developer Access Program for Intel Xeon Phi Processors
> Access to Intel Xeon Phi processor-based developer platforms.
> With one year of Intel Parallel Studio XE.
> Training and support from Colfax.
> Order your platform today. http://sdm.link/xeonphi
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk

-- 
------------
   Peter Nagy
------------

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to