Stig Hemmer | 1 Dec 2011 18:33
Picon

Re: compile function v. dynamic eval of defun

Your make-rk4-model returns a LIST of two lambdas.  The calling
function then tries to pick these apart using MULTIPLE VALUES.

Either return multiple values using VALUES or pick apart the list
using DESTRUCTURING-BIND.

Stig Hemmer

On 11/30/11, billpeople <at> mindspring.com <billpeople <at> mindspring.com> wrote:
> Thanks for your rapid reply.
>
> I realize a reproducible test case is what you need to go further, and I'll
> try to develop that - and I'll move to 1.0.53 as well as trying this on a
> linux box.
>
> That said, I was trying to establish whether I should expect different
> results (or if this is a known issue) from the two different methods of
> producing a compiled function dynamically, hence showing the compilations
> are made in essentially identical lexical environments, and that the code
> being compiled is basically identical.
>
> To directly answer your question on EQUATION-AGGREGATOR, here's the source,
> and in this case, fn is bound to #'+:
>
> (defun equation-aggregator (fn &rest args)
>   (declare (optimize (speed 3) (safety 0)))
>   (let ((tmp (delete nil args)))
>     (if tmp
> 	(reduce fn tmp)
> 	0d0)))
(Continue reading)

billpeople | 1 Dec 2011 20:01
Picon

Re: compile function v. dynamic eval of defun

Thanks everyone.

The issue wasn't that it broke, its that I got different mathematical results - I bound the two lambda's as a
list to a debug variable so I could show the code being run, the function actually returned two values.

I'm running 1.0.53 now.  The issue I've seen is a confluence of speed and safety declarations, as well as
floating point mode settings.

I believe I've now resolved my particular issue.

Thanks again

-----Original Message-----
>From: Stig Hemmer <stighemmer <at> gmail.com>
>Sent: Dec 1, 2011 9:33 AM
>To: billpeople <at> mindspring.com
>Cc: Nikodemus Siivola <nikodemus <at> random-state.net>, sbcl-help <at> lists.sourceforge.net
>Subject: Re: [Sbcl-help] compile function v. dynamic eval of defun
>
>Your make-rk4-model returns a LIST of two lambdas.  The calling
>function then tries to pick these apart using MULTIPLE VALUES.
>
>Either return multiple values using VALUES or pick apart the list
>using DESTRUCTURING-BIND.
>
>Stig Hemmer
>
>On 11/30/11, billpeople <at> mindspring.com <billpeople <at> mindspring.com> wrote:
>> Thanks for your rapid reply.
>>
(Continue reading)

billpeople | 1 Dec 2011 20:02
Picon

Re: compile function v. dynamic eval of defun

Thanks everyone.

The issue wasn't that it broke, its that I got different mathematical results - I bound the two lambda's as a
list to a debug variable so I could show the code being run, the function actually returned two values.

I'm running 1.0.53 now.  The issue I've seen is a confluence of speed and safety declarations, as well as
floating point mode settings.

I believe I've now resolved my particular issue.

Thanks again

-----Original Message-----
>From: Stig Hemmer <stighemmer <at> gmail.com>
>Sent: Dec 1, 2011 9:33 AM
>To: billpeople <at> mindspring.com
>Cc: Nikodemus Siivola <nikodemus <at> random-state.net>, sbcl-help <at> lists.sourceforge.net
>Subject: Re: [Sbcl-help] compile function v. dynamic eval of defun
>
>Your make-rk4-model returns a LIST of two lambdas.  The calling
>function then tries to pick these apart using MULTIPLE VALUES.
>
>Either return multiple values using VALUES or pick apart the list
>using DESTRUCTURING-BIND.
>
>Stig Hemmer
>
>On 11/30/11, billpeople <at> mindspring.com <billpeople <at> mindspring.com> wrote:
>> Thanks for your rapid reply.
>>
(Continue reading)

jcm | 4 Dec 2011 14:55
Favicon

Encoding issue

I'm using this article as a jumping off point to deploy hunchentoot as a
service:

http://zaries.wordpress.com/2010/11/09/lisp-web-server-from-scratch-using-hunchentoot-and-nginx/

But I'm having an encoding issue.  When I start this app from my personal
account, or even the system user that is used by the
'/etc/init.d/hunchentoot start' script, everything works fine.

However, when I start hunchentoot as a server, and attempt to output one
particular name via db query and xml output, I get this:

4: ((FLET #:LAMBDA769)
    #<TYPE-ERROR
      expected-type: BASE-CHAR datum: #\LATIN_CAPITAL_LETTER_A_WITH_TILDE>)
.
.
.
15: (REPLACE "JIM" "JIMÉNEZ, ANGELA")
16: (XML-EMITTER::WRITE-ESCAPED
     "JIMÉNEZ, ANGELA"
     #<SB-IMPL::STRING-OUTPUT-STREAM {CD0D891}>)
17: (XML-EMITTER:SIMPLE-TAG "opt" "JIMÉNEZ, ANGELA" (("val" 783)) NIL)

Even though this form:

(format t "Encoding~%")
(format t "~A~%" (sb-impl::default-external-format))

Outputs:
(Continue reading)

jcm | 4 Dec 2011 16:48
Favicon

Writing non-ascii characters to a file

Is there a tutorial somewhere on writing non-ascii characters to a file?

I have latin-1 encoded characters in a db, and I'm not sure how to write
those out.  I can use flexi-streams:string-to-octets and back, but how can
I use with-open-file to write the correct characters to a text file?

Sorry if this is a simple question, but this is my first foray into
encoding, and I'm sticking with SBCL to do it.

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
ded7b40a | 4 Dec 2011 17:01
Picon
Favicon

Writing non-ascii characters to a file

>Is there a tutorial somewhere on writing non-ascii characters to a file?
>
>I have latin-1 encoded characters in a db, and I'm not sure how to write
>those out.  I can use flexi-streams:string-to-octets and back, but how can
>I use with-open-file to write the correct characters to a text file?
>
>Sorry if this is a simple question, but this is my first foray into
>encoding, and I'm sticking with SBCL to do it.
>

you can either say :external-format or use :element-type

In the first case you specify encoding, in the second type you simply 
use (unsigned-byte 8) and write octets

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
Nikodemus Siivola | 4 Dec 2011 17:22
Gravatar

Re: Writing non-ascii characters to a file

On 4 December 2011 17:48,  <jcm <at> sdf.org> wrote:
> Is there a tutorial somewhere on writing non-ascii characters to a file?
>
> I have latin-1 encoded characters in a db, and I'm not sure how to write
> those out.  I can use flexi-streams:string-to-octets and back, but how can
> I use with-open-file to write the correct characters to a text file?

So, first you get stuff from the DB.

If it arrives as raw octets you can just use pass :ELEMENT-TYPE
'(UNSIGNED-BYTE 8) WITH-OPEN-FILE to write it to file using its
original (in this case latin-1) encoding. If you must write it in, say
:UTF-8 instead, you need to first convert it to a string using eg.
SB-EXT:OCTETS-TO-STRING with :EXTERNAL-FORMAT :LATIN-1 and then
proceed as in the next paragraph.

If it arrives as correctly decoded string, pass :EXTERNAL-FORMAT
:UTF-8 to WITH-OPEN-FILE instead. (Or :LATIN-1, or whatever encoding
you want to write it in.)

If it arrives as an /incorrectly/ decoded string, then you need to
figure out where it goes wrong, and make sure the right external
format is used there.

Cheers,

 -- nikodemus

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
(Continue reading)

Tamas Papp | 5 Dec 2011 09:27
Picon

large functions

Hi,

I am working on AD (automatic differentiation) code in SBCL, and ran
into a problem with implementing it.  This is how it works at the
moment: I take a graph of elementary operations --- think of it as a
long let*, eg

(let* ((var1 x)
       (var2 y)
       (var3 (+ var1 var2))
       ...))

an turn it into another list of elementary operations.  I thought I
could just put it in a LAMBDA and compile, but I get 

Control stack exhausted (no more space for function call frames).
This is probably due to heavily nested or infinitely recursive function
calls, or a tail call that SBCL cannot or has not optimized away.

PROCEED WITH CAUTION.
   [Condition of type SB-KERNEL::CONTROL-STACK-EXHAUSTED]

errors when I try to compile it (toy example at the end of the message).

I am looking for advice on how to do this some other way that

1. works,
2. gives reasonably fast code -- hints are enough, I will benchmark it
   anyway 
3. allows me to leverage the existing CL facilities to a large extent.
(Continue reading)

Nikodemus Siivola | 5 Dec 2011 09:33
Gravatar

Re: large functions

On 5 December 2011 10:27, Tamas Papp <tkpapp <at> gmail.com> wrote:

> (defcrazy 5000)

You can request a larger control stack by doing eg.

  sbcl --control-stack-size 128

which nets you 128 megabytes of stack, enough to compiler this monster.

Cheers,

 -- Nikodemus

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Sbcl-help mailing list
Sbcl-help <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-help
Nikodemus Siivola | 5 Dec 2011 09:34
Gravatar

Re: large functions

On 5 December 2011 10:33, Nikodemus Siivola <nikodemus <at> random-state.net> wrote:

>  sbcl --control-stack-size 128

I should probably also mention that /all/ threads have the same size
control stack at the moment, so spawner beware.

Cheers,

 -- nikodemus

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Sbcl-help mailing list
Sbcl-help <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-help

Gmane