<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>[makefilename] works off of sprintf which allows you to use it's precision modifier; the syntax is a "." followed by a number, sandwiched between the "%" and the type specifier.&nbsp; For symbols, something like "%.2s" means you want a precision of two characters, so [makefilename] will truncate everything after the second character of the symbol.&nbsp; (BTW-- this means it's trivial to make an abstraction in pd that counts the number of characters in a symbol...)<br></span></div><div><br><span></span></div><div><span>So I basically made an outer recursive loop that increments the precision, and an inner iterative loop with [until] that tries to match the symbol at that precision. Since I know your ratio format will only contains digits and a single forward slash, then at most it takes 11 tries to find the first
 character; once the match is found that known character is prefixed to whatever I'm matching in the next iteration of the outer loop.&nbsp; This contiues until the symbol at the current level of precision matches the original symbol.&nbsp; Finally, a list of floats is accumulated from a counter whose value corresponds to the matched symbol for each outer loop iteration.<br></span></div><br>The idiosyncratic recursion happens when combining the single digits to make the final two values of the numerator and denominator.&nbsp; It's a [list split 1] with the middle outlet to a [t a] that feeds back into the left inlet.&nbsp; This outputs the list backwards-- I'm not exactly sure why, but it's handy in this case because I can just multiply each digit by increasing powers of ten and accumulate to get the final value for the numerator.&nbsp; (Same process for the denominator.)&nbsp; There's the danger of a stack overflow, but it's unlikely that either part of
 the fraction would have more than 249 digits.<br><br>Actually now that I look at it, there should be a much greater danger of a stack overflow in the outer loop, because there are seven objects involved in the recursion.&nbsp; But I can still send a 123-character symbol to the abstraction without an overflow.&nbsp; Not sure I understand the relationship between # of objects in recursive chain and max # function calls before stack overflow.<br><br>-Jonathan<br><div><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><font face="Arial" size="2"><hr size="1"><b><span style="font-weight:bold;">From:</span></b> Alexandre Torres Porres &lt;porres@gmail.com&gt;<br><b><span style="font-weight: bold;">To:</span></b> pd-lista puredata
 &lt;pd-list@iem.at&gt;; Jonathan Wilkes &lt;jancsika@yahoo.com&gt;<br><b><span style="font-weight: bold;">Sent:</span></b> Wednesday, August 3, 2011 11:44 AM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [PD] (breaking symbols) was Re: find a list of numbers in a text file<br></font><br><div id="yiv2105679805">Yeah, [s2l], that's the one I knew it existed but couldn't remember. But what I didn't expect is that it'd work so well for this :)<div><br></div><div>But I also always try to see if it's possible to do with vanilla objects, and have a vanilla patch version. I was so convinced it'd be impossible, but Jonathan proved it can be done. Wow, I'm still trying to understand how it works, incredible.</div>
<div><br></div><div>Thanks folks</div><div><br><br><div class="yiv2105679805gmail_quote">2011/8/3 Jonathan Wilkes <span dir="ltr">&lt;<a rel="nofollow" ymailto="mailto:jancsika@yahoo.com" target="_blank" href="mailto:jancsika@yahoo.com">jancsika@yahoo.com</a>&gt;</span><br><blockquote class="yiv2105679805gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div style="color:#000;background-color:#fff;font-family:times new roman, new york, times, serif;font-size:12pt;"><div><span>Aw c'mon, Miller, you didn't even try.<br></span></div><div><br><span></span></div><div>
<span>It's just a little sprintf hacking and  that idiosyncratic recursion that outputs everything backwards.</span></div><div><br><span></span></div><div><span>-Jonathan<br></span></div><div><br><blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px;">
<div style="font-family:times new roman, new york, times, serif;font-size:12pt;"><div style="font-family:times new roman, new york, times, serif;font-size:12pt;"><font face="Arial" size="2"><hr size="1"><b><span style="font-weight:bold;">From:</span></b> Miller Puckette &lt;<a rel="nofollow" ymailto="mailto:msp@ucsd.edu" target="_blank" href="mailto:msp@ucsd.edu">msp@ucsd.edu</a>&gt;<br>
<b><span style="font-weight:bold;">To:</span></b> Alexandre Torres Porres &lt;<a rel="nofollow" ymailto="mailto:porres@gmail.com" target="_blank" href="mailto:porres@gmail.com">porres@gmail.com</a>&gt;<br><b><span style="font-weight:bold;">Cc:</span></b> pd-lista puredata &lt;<a rel="nofollow" ymailto="mailto:pd-list@iem.at" target="_blank" href="mailto:pd-list@iem.at">pd-list@iem.at</a>&gt;<br>
<b><span style="font-weight:bold;">Sent:</span></b> Wednesday, August 3, 2011 12:35 AM<br><b><span style="font-weight:bold;">Subject:</span></b> Re: [PD] (breaking symbols) was Re: find a list of numbers in a text file<br></font><div>
<div></div><div class="yiv2105679805h5"><br>Nope... there needs to be a string-to-binary-list-and-back function somewhere<br>but I can't figure out what to name it :)<br><br>M<br><br>On Wed, Aug 03, 2011 at 01:26:21AM -0300, Alexandre Torres Porres wrote:<br>
&gt; now, some files come in ratios as one symbol like this<br>&gt; <br>&gt; 5/4<br>&gt; 3/2<br>&gt; 7/4<br>&gt; <br>&gt; I'd need to break them into different characters, then treat as numbers to<br>&gt; get interval in cents. How do I do that? I believe I can't do it in any way<br>
&gt; with vanilla objects, right?<br>&gt; <br>&gt; thanks<br>&gt; Alex<br>&gt; <br>&gt; <br>&gt; <br>&gt; 2011/8/3 Alexandre Torres Porres &lt;<a rel="nofollow" ymailto="mailto:porres@gmail.com" target="_blank" href="mailto:porres@gmail.com">porres@gmail.com</a>&gt;<br>
&gt; <br>&gt; &gt; yeah, it works :)<br>&gt; &gt;<br>&gt; &gt; I knew there had to be an easier way other than the mess I did.<br>&gt; &gt;<br>&gt; &gt; Perfect, Thanks<br>&gt; &gt;<br>&gt; &gt; This is a very cool addon feature to my stuff I'm showing at PdCon, see you<br>
&gt; &gt; all there.<br>&gt; &gt;<br>&gt; &gt; See you all there soon!<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; 2011/8/3 Miller Puckette &lt;<a rel="nofollow" ymailto="mailto:msp@ucsd.edu" target="_blank" href="mailto:msp@ucsd.edu">msp@ucsd.edu</a>&gt;<br>
&gt; &gt;<br>&gt; &gt;&gt; HI Alex --<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; Have you tried sending textfile an "open [my-filename] cr" message?&nbsp; The<br>&gt; &gt;&gt; "cr" flag asks to interpret newlines as end-of-list.<br>
&gt; &gt;&gt;<br>&gt; &gt;&gt; cheers<br>&gt; &gt;&gt; Miller<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; On Tue, Aug 02, 2011 at
 11:51:17PM -0300, Alexandre Torres Porres wrote:<br>&gt; &gt;&gt; &gt; Hi folks<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt; Back in the end of my masters, I did make something that allows you to<br>&gt; &gt;&gt; load<br>
&gt; &gt;&gt; &gt; scales from the Scala software into Pd, which has a database of over<br>&gt; &gt;&gt; 4000<br>&gt; &gt;&gt; &gt; scales.<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt; Check the software and data bank here<br>
&gt; &gt;&gt; <a rel="nofollow" target="_blank" href="http://www.huygens-fokker.org/scala/">http://www.huygens-fokker.org/scala/</a><br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt; It's an extremely powerful tool for microtonality, but you may not care<br>
&gt; &gt;&gt; for<br>&gt; &gt;&gt; &gt; that and just want to use the scale data bank in Pd.<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt; Anyway, I have a way that exports the&nbsp; from the Scala software into a<br>&gt; &gt;&gt; text<br>
&gt; &gt;&gt; &gt; file that opens in this
 specific subpatch of mine.<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt; But I was trying to do something easier, and that is just load these<br>&gt; &gt;&gt; *.scl<br>&gt; &gt;&gt; &gt; files into [textfile] or [msgfile] for example, and extracting the list<br>
&gt; &gt;&gt; of<br>&gt; &gt;&gt; &gt; these scale intervals in cents.<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt; Here's what one of these files look like<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt; ==============<br>
&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt; ! 08-11.scl<br>&gt; &gt;&gt; &gt; !<br>&gt; &gt;&gt; &gt; 8 out of 11-tET<br>&gt; &gt;&gt; &gt;&nbsp; 8<br>&gt; &gt;&gt; &gt; !<br>&gt; &gt;&gt; &gt;&nbsp; 218.18182<br>&gt; &gt;&gt; &gt;&nbsp; 327.27273<br>
&gt; &gt;&gt; &gt;&nbsp; 436.36364<br>&gt; &gt;&gt; &gt;&nbsp; 654.54545<br>&gt; &gt;&gt; &gt;&nbsp; 763.63636<br>&gt; &gt;&gt; &gt;&nbsp; 872.72727<br>&gt; &gt;&gt; &gt;&nbsp; 1090.90909<br>&gt; &gt;&gt; &gt;&nbsp;
 2/1<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt; ===============<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt; So I assumed it'd be easy to extract each cents value and make a list<br>&gt; &gt;&gt; out of<br>
&gt; &gt;&gt; &gt; it, but I was wrong. Don't know why but it doesn't load this in separate<br>&gt; &gt;&gt; &gt; lines, maybe because it is not a *.txt file at all.<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt; And anyway, I'm getting in Pd just a list, so the above file, for<br>
&gt; &gt;&gt; example,<br>&gt; &gt;&gt; &gt; file becomes<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt; list ! 08-11.scl ! 8 out of 11-tET 8 ! 218.182 327.273 436.364 654.545<br>&gt; &gt;&gt; &gt; 763.636 872.727 1090.91 2/1<br>
&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt; I seem to have found a messy way to get the list out of it, but maybe<br>&gt; &gt;&gt; you<br>&gt; &gt;&gt; &gt; people know of something really
 simple and elegant with some extended<br>&gt; &gt;&gt; &gt; objects.<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt; Thanks<br>&gt; &gt;&gt; &gt; Alex<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; &gt; _______________________________________________<br>
&gt; &gt;&gt; &gt; <a rel="nofollow" ymailto="mailto:Pd-list@iem.at" target="_blank" href="mailto:Pd-list@iem.at">Pd-list@iem.at</a> mailing list<br>&gt; &gt;&gt; &gt; UNSUBSCRIBE and account-management -&gt;<br>&gt; &gt;&gt; <a rel="nofollow" target="_blank" href="http://lists.puredata.info/listinfo/pd-list">http://lists.puredata.info/listinfo/pd-list</a><br>
&gt; &gt;&gt;<br>&gt; &gt;&gt;<br>&gt; &gt;<br><br>&gt; _______________________________________________<br>&gt; <a rel="nofollow" ymailto="mailto:Pd-list@iem.at" target="_blank" href="mailto:Pd-list@iem.at">Pd-list@iem.at</a> mailing list<br>&gt; UNSUBSCRIBE and account-management -&gt; <a rel="nofollow" target="_blank" href="http://lists.puredata.info/listinfo/pd-list">http://lists.puredata.info/listinfo/pd-list</a><br>
<br><br>_______________________________________________<br><a rel="nofollow" ymailto="mailto:Pd-list@iem.at" target="_blank" href="mailto:Pd-list@iem.at">Pd-list@iem.at</a> mailing list<br>UNSUBSCRIBE and account-management -&gt; <a rel="nofollow" target="_blank" href="http://lists.puredata.info/listinfo/pd-list">http://lists.puredata.info/listinfo/pd-list</a><br>
<br><br></div></div></div></div></blockquote></div></div></div></blockquote></div><br></div>
</div><br><br></div></div></blockquote></div></div></body></html>