In pd_typedmess of m_class.c, the float handler will currently throw an error 
if the arg isn't a float atom.  However, this could be changed so that if the 
arg is a symbol-atom Pd sends it through a binbuf "carwash" to check if it 
comes out as a float.  If so, it could send it on its way.  If not, it would 
throw the same error it currently does.

So

[0(
|
[makefilename %d]
|
[float $1(
|
[route float]
|
[print success]


This wouldn't add any overhead to Pd's current message-dispatching system, as 
the conversion would only get triggered for symbol-args which currently throw 
an error.

-Jonathan



On Tuesday, October 28, 2014 7:06 AM, Roman Haefeli <reduz...@gmail.com> wrote:
 


On Tue, 2014-10-28 at 09:21 +0100, Frank Barknecht wrote:
> Hi Chris,
> 
> I think, for the way back some external based on atoi(3) or atof(3) is needed.
> I'm pretty sure someone has made one already. The "0" in the printed "symbol 
> 0"
> is a real symbol atom itself, just like the word "zero" would. One could
> [select] it, but if you don't know what symbol-number youmight get, only atoX
> can convert back, I believe. But I might be wrong ...


I know of at least two ways to convert symbolic numbers into real
floats, but none of them is really satisfying. One is to save the symbol
or list containing symbolic numbers with [textfile] and re-read the file
afterwards. The other one is sending such a symbol/list through
[netsend]/[netreceive]. I consider them not satisfying because it either
involves an unnecessary file system access (and there is no save
temporary path that works across platforms), the other one is not
execution order safe.

How about a [list eval], that would re-evaluate the incoming list and
would consider only its plain content while disregarding the used atom
types. Does that make sense?

Roman

> On Sun, Oct 26, 2014 at 10:02:17PM +0800, Chris McCormick wrote:
> > Hi Frank,
> > 
> > On 13/10/14 21:40, Frank Barknecht wrote:
> > >  [bang(
> > >  |
> > >  [oscformat 0]
> > >  |
> > >  [oscparse]
> > >  |
> > >  [print]
> > > 
> > > It will print "symbol 0"!
> > 
> > Seems you can do this with "list tosymbol" and also "makefilename %d" -
> > any idea how I can get from one of those symbols back to a proper float
> > again? I am sure I should know this by now!
> > 
> > Cheers,
> > 
> > Chris.
> > 
> > -- 
> > http://mccormick.cx/
> 



_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list
_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to