P.S., this is fun to show off too, also implemented as a library.
USING: infix ;
INFIX:: quadratic-root ( a b c -- x )
(-b+sqrt(sq(b)-(4*a*c)))/(2*a) ;
It's a little fragile though, I just noticed it doesn't seem to let me
output more than one value on the stack (-b +/- sqrt...)
On Fri, Jun 16, 2017 at 5:20 PM, John Benediktsson <mrj...@gmail.com> wrote:
> This is GREAT!
>
> I love the topics covered, the step-through approach, and the overall
> feeling. I bet that was a great presentation.
>
> Best,
> John.
>
> On Fri, Jun 16, 2017 at 5:09 PM, Sankaranarayanan Viswanathan <
> rationalrev...@gmail.com> wrote:
>
>> Hello Everyone,
>>
>> Thank you for your inputs. In the end, I decided to focus on the aspects
>> of Factor that I was most amazed by when I first discovered the language
>> last year. I presented yesterday, and it was received well. I think I
>> kindled the interest of a few people who attended.
>>
>> The slide I went over are here:
>> https://github.com/viswans83/stack-based-languages-presentation
>>
>> Thanks again,
>> Sankar
>>
>>
>> On 6/1/17 4:05 AM, Alexander Ilin wrote:
>>
>>> John, the question was specifically about the quotation parameter's
>>> stack effects in general, i.e. `quot: ( x -- x )` vs. simply `quot` in
>>> the parameter lists.
>>>
>>> My take is that the quotation stack effects are not checked separately
>>> on a per-parameter basis, only the word as a whole is checked. So, they
>>> are merely for documentation purposes, and may be incorrect with no
>>> penalty. From the documentation: "For words that are not inline, only
>>> the number of inputs and outputs carries semantic meaning, and effect
>>> variables are ignored."
>>>
>>> http://docs.factorcode.org/content/article-effects.html
>>>
>>> 01.06.2017, 05:33, "John Benediktsson" <mrj...@gmail.com>:
>>>
>>>> Well, technically neither ``dip`` nor ``keep`` need those stack
>>>> effects, they are inlined which means the non-inline word that
>>>> includes them will have it's stack effect checked by the compiler for
>>>> correctness.
>>>>
>>>> There are few reasons why we want to have the ".." variadic stack
>>>> effects, and those are useful in the stack-checker and visually for
>>>> documentation, but if you removed them and tried to compile a word
>>>> that was incorrect, it would give you a worse error message but still
>>>> give you an error.
>>>>
>>>>
>>>>
>>>> On Wed, May 31, 2017 at 7:03 PM, Sankaranarayanan Viswanathan
>>>> <rationalrev...@gmail.com <mailto:rationalrev...@gmail.com>> wrote:
>>>>
>>>> Thanks for the ideas John!
>>>>
>>>> I have been looking at the collection of talks, and they've been
>>>> quite helpful. Your thoughts about discussing "Java like" things
>>>> makes a lot of sense and I think contrasting Factor's object
>>>> system with Java's should be a nice topic.
>>>>
>>>> That said, I did run into a question preparing the slides related
>>>> to stack-effects. I noticed that some combinators do not specify
>>>> stack effects for quotation inputs.
>>>>
>>>> e.g.
>>>> dip ( x quot -- x )
>>>> keep ( ..a x quot: ( ..a x -- ..b ) -- ..b x )
>>>>
>>>> Why does `dip` not need to specify the quotations stack effect,
>>>> but `keep` did? I suspect they also have something to do with the
>>>> inline word, but I'm not really sure. Could you explain?
>>>>
>>>> Thanks,
>>>> Sankar
>>>>
>>>>
>>>>
>>>> On 5/30/17 11:47 PM, John Benediktsson wrote:
>>>>
>>>> We have a few "talks" that were given a number of years ago
>>>> (not all
>>>> code in them is up to date, but it's mostly good -- if you
>>>> have problems
>>>> updating the code let me know and I can help):
>>>>
>>>> https://github.com/factor/factor/tree/master/extra/talks
>>>>
>>>> https://github.com/slavapestov/boston-lisp-talk
>>>>
>>>> https://github.com/slavapestov/emerging-langs-talk
>>>>
>>>> You might find it interesting to discuss "Java-like" things, for
>>>> example, interfaces vs protocols:
>>>>
>>>> public interface Foo {
>>>> String a();
>>>> int b();
>>>> }
>>>>
>>>> public class FooImpl {
>>>> public String a() { return "hello" } ;
>>>> public int b() { return 42 } ;
>>>> }
>>>>
>>>> vs a protocol (two generic methods) and a concrete class that
>>>> implements
>>>> it...
>>>>
>>>> GENERIC: a ( obj -- a )
>>>> GENERIC: b ( obj -- a )
>>>>
>>>> TUPLE: foo ;
>>>> M: foo a "hello" ;
>>>> M: foo b 42 ;
>>>>
>>>> Could also talk about ``SINGLETON:``, so instead of (plus or
>>>> minus
>>>> thread safety):
>>>>
>>>> public class Foo {
>>>> private static _instance = null;
>>>> public static Foo getInstance() {
>>>> if ( _instance == null ) { _instance = new Foo() };
>>>> return _instance;
>>>> }
>>>> }
>>>>
>>>> vs.
>>>>
>>>> SINGLETON: foo
>>>>
>>>> So, touching on code generation and higher level concepts.
>>>>
>>>> Maybe macros might be interesting?
>>>>
>>>> Some other ideas from my blog, not sure of your audience's
>>>> interest:
>>>>
>>>>
>>>> https://re-factor.blogspot.com/2009/08/calculating-with-ebnf
>>>> .html
>>>>
>>>>
>>>> https://re-factor.blogspot.com/2010/11/estimating-cpu-speed.
>>>> html
>>>>
>>>> https://re-factor.blogspot.com/2011/02/simple-rpg.html
>>>>
>>>> https://re-factor.blogspot.com/2011/04/powers-of-2.html
>>>>
>>>> https://re-factor.blogspot.com/2011/04/mail-with-gui.html
>>>>
>>>>
>>>> https://re-factor.blogspot.com/2011/07/concatenative-thinkin
>>>> g.html
>>>>
>>>> https://re-factor.blogspot.com/2011/07/one-liners.html
>>>>
>>>> https://re-factor.blogspot.com/2011/08/printf.html
>>>>
>>>> https://re-factor.blogspot.com/2012/02/readability.html
>>>>
>>>>
>>>> https://re-factor.blogspot.com/2012/08/literate-programming.
>>>> html
>>>>
>>>>
>>>> https://re-factor.blogspot.com/2013/10/rock-paper-scissors.html
>>>>
>>>> https://re-factor.blogspot.com/2015/06/send-more-money.html
>>>>
>>>> https://re-factor.blogspot.com/2017/02/711.html
>>>>
>>>> Best,
>>>> John.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Tue, May 30, 2017 at 8:14 PM, Sankaranarayanan Viswanathan
>>>> <rationalrev...@gmail.com <mailto:rationalrev...@gmail.com>
>>>> <mailto:rationalrev...@gmail.com
>>>>
>>>> <mailto:rationalrev...@gmail.com>>> wrote:
>>>>
>>>> Hi Guys,
>>>>
>>>> We have a developer community at where I work, and we do
>>>> monthly
>>>> tech talks that usually last between 30 and 40 minutes. I
>>>> presume
>>>> very few in that group have looked at stack based
>>>> languages before,
>>>> and I've been wanting to do a small talk about Factor there.
>>>>
>>>> After spending a week preparing slides, I'm having a bit
>>>> of trouble
>>>> understanding what would be a meaningful scope for my
>>>> talk. I really
>>>> want to touch upon a couple of aspects:
>>>> - show what stack based code looks like (i.e. avoid naming
>>>> variables most of the time)
>>>> - show that all syntax is just words, and that syntax is
>>>> extensible
>>>> - show a little of the help system
>>>> - show a bit of the interactive development workflow
>>>> (change,
>>>> refresh, test)
>>>>
>>>> But, I'm suspecting before I even get here I might need to
>>>> spend a
>>>> lot of time talking about stack-effects, combinators, and
>>>> other
>>>> basics before they might get a feel for what factor code
>>>> feels like.
>>>> And this I'm afraid might be a little too much to digest
>>>> in a short
>>>> time. Words like dip, bi@ and sequence combinators like
>>>> map seem
>>>> fundamental to work with factor, and I'm afraid a short
>>>> presentation
>>>> might not be the best place to introduce these topics.
>>>> But, without
>>>> them code examples are going to be hard to understand.
>>>>
>>>> Any ideas?
>>>>
>>>> Thanks,
>>>> Sankar
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------
>>>> ------------------
>>>> Check out the vibrant tech community on one of the world's
>>>> most
>>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>>> _______________________________________________
>>>> Factor-talk mailing list
>>>> Factor-talk@lists.sourceforge.net
>>>> <mailto:Factor-talk@lists.sourceforge.net>
>>>> <mailto:Factor-talk@lists.sourceforge.net
>>>> <mailto:Factor-talk@lists.sourceforge.net>>
>>>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>>> <https://lists.sourceforge.net/lists/listinfo/factor-talk>
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------
>>>> ------------------
>>>> Check out the vibrant tech community on one of the world's most
>>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Factor-talk mailing list
>>>> Factor-talk@lists.sourceforge.net
>>>> <mailto:Factor-talk@lists.sourceforge.net>
>>>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------
>>>> ------------------
>>>> Check out the vibrant tech community on one of the world's most
>>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>>> _______________________________________________
>>>> Factor-talk mailing list
>>>> Factor-talk@lists.sourceforge.net
>>>> <mailto:Factor-talk@lists.sourceforge.net>
>>>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>>>
>>>> ,
>>>>
>>>> ------------------------------------------------------------
>>>> ------------------
>>>> Check out the vibrant tech community on one of the world's most
>>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>>>
>>>> ,
>>>>
>>>> _______________________________________________
>>>> Factor-talk mailing list
>>>> Factor-talk@lists.sourceforge.net
>>>> <mailto:Factor-talk@lists.sourceforge.net>
>>>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>>>
>>>>
>>>
>>> ---=====---
>>> Александр
>>>
>>>
>>>
>>> ------------------------------------------------------------
>>> ------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>>
>>>
>>>
>>> _______________________________________________
>>> Factor-talk mailing list
>>> Factor-talk@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>>
>>>
>>
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk