The notion of homoiconicity is a very _loose_ one. Taken literally, it means
'the same as its representation', which poses two problems: 1, what does it
mean for two things to be the same?; and 2, must we pick a single
representation?
The following links may be of interest, though I do not entirely agree with
them: http://calculist.org/blog/2012/04/17/homoiconicity-isnt-the-point/
https://twitter.com/lexi_lambda/status/1533127548577652737
With respect to the looseness of homoiconicity, however, j supports a feature,
'atomic representations', which is quite relevant. I dare not say whether it
makes j homoiconic or not. Example:
f=. +/ % #
fr=. (+/ % #) `'' NB. fr is a representation of f
NB. fr is also an ordinary j noun, which may be manipulated at will as any
other j noun, cf:
fr
┌─────────────────┐
│┌─┬─────────────┐│
││3│┌───────┬─┬─┐││
││ ││┌─┬───┐│%│#│││
││ │││/│┌─┐││ │ │││
││ │││ ││+│││ │ │││
││ │││ │└─┘││ │ │││
││ ││└─┴───┘│ │ │││
││ │└───────┴─┴─┘││
│└─┴─────────────┘│
└─────────────────┘
>fr
┌─┬─────────────┐
│3│┌───────┬─┬─┐│
│ ││┌─┬───┐│%│#││
│ │││/│┌─┐││ │ ││
│ │││ ││+│││ │ ││
│ │││ │└─┘││ │ ││
│ ││└─┴───┘│ │ ││
│ │└───────┴─┴─┘│
└─┴─────────────┘
0{::>fr
┌─┬─────────────┐
│3│┌───────┬─┬─┐│
│ ││┌─┬───┐│%│#││
│ │││/│┌─┐││ │ ││
│ │││ ││+│││ │ ││
│ │││ │└─┘││ │ ││
│ ││└─┴───┘│ │ ││
│ │└───────┴─┴─┘│
└─┴─────────────┘
NB. etc.
NB. primitive symbolic calculus packages have been built in this fashion;
see https://github.com/jsoftware/math_calculus
Observe that here we have gone _backwards_: from code (f) to data (fr); this
is something that 'homoiconic' languages such as lisp do not generally allow
you to do. Does this mean j is more homoiconic than they? Again, I dare not
say.
-E
On Sun, 24 Jul 2022, tu...@posteo.de wrote:
Hi,
is J homoiconic?
Cheers!
Meino
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm