Terrence Brannon | 1 Mar 2010 16:29
Picon
Gravatar

printing a sequence to STDERR

I thought this would work, but would appreciate some help:

{ "and a " "bottle of rum" "yo ho ho" }
[ error-stream get stream-print ]
each

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
Terrence Brannon | 1 Mar 2010 16:44
Picon
Gravatar

Re: printing a sequence to STDERR

This isnt working either -

{ "af" "df" } error-stream get [ [ print ] each ]   with-output-stream*

On Mon, Mar 1, 2010 at 10:29 AM, Terrence Brannon
<schemelab@...> wrote:
> I thought this would work, but would appreciate some help:
>
> { "and a " "bottle of rum" "yo ho ho" }
> [ error-stream get stream-print ]
> each
>

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
Jon Harper | 1 Mar 2010 16:51
Picon
Gravatar

Re: printing a sequence to STDERR

You have to currify the sequence in the quotation with "with"
{ "and a " "bottle of rum" "yo ho ho" }
[ error-stream get stream-print ]
with
each

Jon Harper

On Mon, Mar 1, 2010 at 4:44 PM, Terrence Brannon <schemelab@...> wrote:
> This isnt working either -
>
> { "af" "df" } error-stream get [ [ print ] each ]   with-output-stream*
>
>
> On Mon, Mar 1, 2010 at 10:29 AM, Terrence Brannon
<schemelab@...> wrote:
>> I thought this would work, but would appreciate some help:
>>
>> { "and a " "bottle of rum" "yo ho ho" }
>> [ error-stream get stream-print ]
>> each
>>
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
(Continue reading)

Jon Harper | 1 Mar 2010 16:52
Picon
Gravatar

Re: printing a sequence to STDERR

ups, disregard my last message :s
Jon Harper

On Mon, Mar 1, 2010 at 4:51 PM, Jon Harper <jon.harper87@...> wrote:
> You have to currify the sequence in the quotation with "with"
> { "and a " "bottle of rum" "yo ho ho" }
> [ error-stream get stream-print ]
> with
> each
>
> Jon Harper
>
>
>
> On Mon, Mar 1, 2010 at 4:44 PM, Terrence Brannon
<schemelab@...> wrote:
>> This isnt working either -
>>
>> { "af" "df" } error-stream get [ [ print ] each ]   with-output-stream*
>>
>>
>> On Mon, Mar 1, 2010 at 10:29 AM, Terrence Brannon
<schemelab@...> wrote:
>>> I thought this would work, but would appreciate some help:
>>>
>>> { "and a " "bottle of rum" "yo ho ho" }
>>> [ error-stream get stream-print ]
>>> each
>>>
>>
(Continue reading)

Samuel Tardieu | 1 Mar 2010 16:56
Gravatar

Re: printing a sequence to STDERR



2010/3/1 Terrence Brannon <schemelab-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
I thought this would work, but would appreciate some help:

{ "and a " "bottle of rum" "yo ho ho" }
[ error-stream get stream-print ]
each

You may need to flush the stream to see its output.

Try:

 { "and a " "bottle of rum" "yo ho ho" } [ error-stream get [ stream-print ] [ stream-flush ] bi ] each

  Sam
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Factor-talk mailing list
Factor-talk@...
https://lists.sourceforge.net/lists/listinfo/factor-talk
Terrence Brannon | 1 Mar 2010 19:13
Picon
Gravatar

attempting to write a document spell-checker yields out of memory

! I get an out of memory error with the document below when I call it
with "she hit her hard" spell

USING: assocs hashtables kernel locals sequences splitting ;
IN: factor-4gl.spell

: dictionary-words ( -- seq ) "he hit her hard" " " split ;

:: (mk-lookup) ( hashtable seq --  ) seq [ 1 swap hashtable set-at  ] each ;

: mk-lookup ( -- hashtable ) 1 <hashtable> dup dictionary-words (mk-lookup) ;

:: in-assoc? ( key assoc -- ? ) key assoc at* swap drop ;

: (spell) ( document -- not-found ) [ mk-lookup in-assoc? not ] filter ;

: spell ( string -- seq ) " " split spell ;

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
Terrence Brannon | 1 Mar 2010 19:17
Picon
Gravatar

Re: printing a sequence to STDERR

Actually I just had to switch it to output-stream.

Unlike a Unix console, where you see STDERR and STDOUT on the screen,
the error-stream of the document doesnt automatically go to the
screen.

On Mon, Mar 1, 2010 at 10:56 AM, Samuel Tardieu <sam@...> wrote:
>
>
> 2010/3/1 Terrence Brannon <schemelab@...>
>>
>> I thought this would work, but would appreciate some help:
>>
>> { "and a " "bottle of rum" "yo ho ho" }
>> [ error-stream get stream-print ]
>> each
>
> You may need to flush the stream to see its output.
>
> Try:
>
>  { "and a " "bottle of rum" "yo ho ho" } [ error-stream get [ stream-print ]
> [ stream-flush ] bi ] each
>
>   Sam
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@...
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
Samuel Tardieu | 1 Mar 2010 19:23
Gravatar

Re: attempting to write a document spell-checker yields out of memory



2010/3/1 Terrence Brannon <schemelab-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
! I get an out of memory error with the document below when I call it
with "she hit her hard" spell

: spell ( string -- seq ) " " split spell ;

Looks like a plain old infinite recursion to me. Didn't you mean "(spell)" instead?
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Factor-talk mailing list
Factor-talk@...
https://lists.sourceforge.net/lists/listinfo/factor-talk
Terrence Brannon | 1 Mar 2010 19:25
Picon
Gravatar

Re: attempting to write a document spell-checker yields out of memory

On Mon, Mar 1, 2010 at 1:23 PM, Samuel Tardieu <sam@...> wrote:
>
>
> 2010/3/1 Terrence Brannon <schemelab@...>
>>
>> ! I get an out of memory error with the document below when I call it
>> with "she hit her hard" spell
>>
>> : spell ( string -- seq ) " " split spell ;
>
> Looks like a plain old infinite recursion to me. Didn't you mean "(spell)"
> instead?

lol, yes, how embarrassing :)

: spell ( string -- seq ) " " split (spell) ;

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
Samuel Tardieu | 3 Mar 2010 02:51
Gravatar

Monotonic counters and Virtualbox on 64 bits Linux host

Jon and I have encountered a strange issue when using VirtualBox with 64 bits Linux hosts: the monotonic counter is not monotonic, with both 32 and 64 bits Linux guest systems.

The attached program (compile with "gcc -O2 -o t t.c -lrt") gives an error when executed onto the guest system with the following configurations:

  • Host: 64 bits Linux 2.6.29 x86_64 + VirtualBox 3.0.2, Guest: 32 bits Linux 2.6.32 i686
  • Host: 64 bits Linux 2.6.32 x86_64 + VirtualBox 3.1.4, Guest: 32 bits Linux 2.6.32 x86_64
The monotonic timer jumps backwards in time, causing a critical error in Factor.

I've implemented the following stupid hack that can be pulled from "git://git.rfc1149.net/factor.git for-slava":

--- a/vm/run.cpp
+++ b/vm/run.cpp
<at> <at> -16,7 +16,8 <at> <at> void factor_vm::primitive_system_micros()
 void factor_vm::primitive_nano_count()
 {
        u64 nanos = nano_count();
-       if(nanos < last_nano_count) critical_error("Monotonic counter decreased",0);
+       if(nanos < last_nano_count)
+         nanos = last_nano_count + 1;
        last_nano_count = nanos;
        ctx->push(from_unsigned_8(nanos));
 }

This does not seem to cause any trouble for Factor itself as the correction is a one-time shot every time the problem occurs, and lets us use Factor in VirtualBox with a 64 bits host. This should not change anything for systems functioning correctly (the test program does not exhibit the bogus behaviour when executed directly onto the host system).

  Sam
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Factor-talk mailing list
Factor-talk@...
https://lists.sourceforge.net/lists/listinfo/factor-talk

Gmane