From: Jon Harrop
Subject: infix.lisp
Date: 
Message-ID: <464f2393$0$8729$ed2619ec@ptn-nntp-reader02.plus.net>
Raffael Cavallaro wrote:
> Though lisp macros are not optimized for low-level character juggling,
> read macros can be used for this, and the existing infix.lisp is a good
> example.

Is Lisp's infix macro extensible? Can you insert a new precedence level and
add new operators to it?

-- 
Dr Jon D Harrop, Flying Frog Consultancy
The F#.NET Journal
http://www.ffconsultancy.com/products/fsharp_journal/?usenet

From: Raffael Cavallaro
Subject: Re: infix.lisp
Date: 
Message-ID: <2007051912444993099-raffaelcavallaro@pasdespamsilvousplaitmaccom>
On 2007-05-19 12:14:19 -0400, Jon Harrop <···@ffconsultancy.com> said:

> Is Lisp's infix macro extensible? Can you insert a new precedence level and
> add new operators to it?

Precedence (or operator-ordering as it's called in the code) is 
contained in a single defparameter form. New operators would require 
insertion into this list and you would need to add a 
define-token-operator form for the new operator - most of the existing 
ones are 2 to 5 lines long. If the new operator were more than one 
character, you'd need a define-character-tokenization form for each of 
the leading characters - these are typically 3 to 10 lines. Take a look 
at the code - I'm sure a master of such a superior language as OCaml 
will find it child's play ;^)
From: Jon Harrop
Subject: Re: infix.lisp
Date: 
Message-ID: <464f3590$0$8739$ed2619ec@ptn-nntp-reader02.plus.net>
Raffael Cavallaro wrote:
> On 2007-05-19 12:14:19 -0400, Jon Harrop <···@ffconsultancy.com> said:
>> Is Lisp's infix macro extensible? Can you insert a new precedence level
>> and add new operators to it?
> 
> Precedence (or operator-ordering as it's called in the code) is
> contained in a single defparameter form. New operators would require
> insertion into this list and you would need to add a
> define-token-operator form for the new operator - most of the existing
> ones are 2 to 5 lines long. If the new operator were more than one
> character, you'd need a define-character-tokenization form for each of
> the leading characters - these are typically 3 to 10 lines. Take a look
> at the code

Thanks. Can this be done without altering (or copying) the source code of
infix.lisp?

-- 
Dr Jon D Harrop, Flying Frog Consultancy
The F#.NET Journal
http://www.ffconsultancy.com/products/fsharp_journal/?usenet
From: Rainer Joswig
Subject: Re: infix.lisp
Date: 
Message-ID: <joswig-7F6E1B.19483319052007@news-europe.giganews.com>
In article <························@ptn-nntp-reader02.plus.net>,
 Jon Harrop <···@ffconsultancy.com> wrote:

> Raffael Cavallaro wrote:
> > On 2007-05-19 12:14:19 -0400, Jon Harrop <···@ffconsultancy.com> said:
> >> Is Lisp's infix macro extensible? Can you insert a new precedence level
> >> and add new operators to it?
> > 
> > Precedence (or operator-ordering as it's called in the code) is
> > contained in a single defparameter form. New operators would require
> > insertion into this list and you would need to add a
> > define-token-operator form for the new operator - most of the existing
> > ones are 2 to 5 lines long. If the new operator were more than one
> > character, you'd need a define-character-tokenization form for each of
> > the leading characters - these are typically 3 to 10 lines. Take a look
> > at the code
> 
> Thanks. Can this be done without altering (or copying) the source code of
> infix.lisp?

          \|||/
          (o o)
 |~~~~ooO~~(_)~~~~~~~|
 | Please            |
 | don't feed the    |
 | TROLL!            |
 '~~~~~~~~~~~~~~Ooo~~'
         |__|__|
          || ||
         ooO Ooo

-- 
http://lispm.dyndns.org
From: Alex Mizrahi
Subject: Re: infix.lisp
Date: 
Message-ID: <464f4558$0$90275$14726298@news.sunsite.dk>
(message (Hello 'Jon)
(you :wrote  :on '(Sat, 19 May 2007 18:31:04 +0100))
(

 JH> Thanks. Can this be done without altering (or copying) the source code
 JH> of infix.lisp?

i'm sorry, i've missed which "infix.lisp" are you talking about, but in 
three i've found on the web it looks quite straightforward -- define new 
operator, functions and insert into list.
believe me or not, but you can insert values inside lists in LISP!

moreover, this http://plaza.ufl.edu/lavigne/resources/infix/infix.lisp 
appears to have such macro:

(definfix my-infix-symbol
  :precedence 40
  :function-name +)

looks quite extensible, right?

i can say more, even if you've found some patalogic infix.lisp that does not 
allow to change precendence, Lisp has very powerful reflection and 
introspection, so it would be quite easy to extend it even if author 
specially made it non-extensible!
but most sane authors just keep data in lists and hash-tables, than can be 
modified afterwards (i repeat twice because our clever ML programmer failed 
to understand when Raffael told him "insertion into this list". Lisp is not 
Haskell, lists are mutable here, no need to alter code)

)
(With-best-regards '(Alex Mizrahi) :aka 'killer_storm)
"I am everything you want and I am everything you need") 
From: Jon Harrop
Subject: Re: infix.lisp
Date: 
Message-ID: <464f5945$0$8710$ed2619ec@ptn-nntp-reader02.plus.net>
Alex Mizrahi wrote:
> (definfix my-infix-symbol
>   :precedence 40
>   :function-name +)
> 
> looks quite extensible, right?

Brilliant. Thanks.

-- 
Dr Jon D Harrop, Flying Frog Consultancy
The F#.NET Journal
http://www.ffconsultancy.com/products/fsharp_journal/?usenet
From: Rainer Joswig
Subject: Re: infix.lisp
Date: 
Message-ID: <joswig-ED50B1.18293319052007@news-europe.giganews.com>
In article <························@ptn-nntp-reader02.plus.net>,
 Jon Harrop <···@ffconsultancy.com> wrote:

> Raffael Cavallaro wrote:
> > Though lisp macros are not optimized for low-level character juggling,
> > read macros can be used for this, and the existing infix.lisp is a good
> > example.
> 
> Is Lisp's infix macro extensible? Can you insert a new precedence level and
> add new operators to it?



          \|||/
          (o o)
 |~~~~ooO~~(_)~~~~~~~|
 | Please            |
 | don't feed the    |
 | TROLL!            |
 '~~~~~~~~~~~~~~Ooo~~'
         |__|__|
          || ||
         ooO Ooo

-- 
http://lispm.dyndns.org
From: Raffael Cavallaro
Subject: Re: infix.lisp
Date: 
Message-ID: <2007051912461980278-raffaelcavallaro@pasdespamsilvousplaitmaccom>
On 2007-05-19 12:29:33 -0400, Rainer Joswig <······@lisp.de> said:

> 
> 
>           \|||/
>           (o o)
>  |~~~~ooO~~(_)~~~~~~~|
>  | Please            |
>  | don't feed the    |
>  | TROLL!            |
>  '~~~~~~~~~~~~~~Ooo~~'
>          |__|__|
>           || ||
>          ooO Ooo

Sorry, you're right.

Jon - just read infix.lisp if you have any real interest beyond trolling.