homoiconicity

Pattern bindings for existential constructors

ⅰ亾dé卋堺 提交于 2021-01-27 20:35:52
问题 While writing Haskell as a programmer that had exposure to Lisp before, something odd came to my attention, which I failed to understand. This compiles fine: {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE ExistentialQuantification #-} data Foo = forall a. Show a => Foo { getFoo :: a } showfoo :: Foo -> String showfoo Foo{getFoo} = do show getFoo whereas this fails: {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE ExistentialQuantification #-} data Foo = forall a. Show a => Foo { getFoo :: a }

In what sense are languages like Elixir and Julia homoiconic?

折月煮酒 提交于 2019-12-20 08:47:21
问题 Homoiconicity in Lisp is easy to see: (+ 1 2) is both the function call to + with 1 , 2 as arguments, as well as being a list containing + , 1 , and 2 . It is simultaneously both code and data. In a language like Julia, though: 1 + 2 I know we can parse this into an Expr in Julia: :(1 + 2) And then we can get the AST and manipulate it: julia> Meta.show_sexpr(:(1+2)) (:call, :+, 1, 2) So, we can manipulate a program's AST in Julia (and Elixir). But are they homoiconic in the same sense as Lisp

Practical example of Lisp's flexibility? [closed]

匆匆过客 提交于 2019-12-20 08:17:24
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Someone is trying to sell Lisp to me, as a super powerful language that can do everything ever, and then some. Is there a practical

XML Meta Schema

时光怂恿深爱的人放手 提交于 2019-12-11 15:44:11
问题 Since XML schemata (XSD) are themselves XML files, it should be possible to build a schema of a schema (meta-schema), right? I'm struggling to accomplish that feat. I would like to create a schema that describes a schema with one root complexType containing a sequence of simpleTypes . 回答1: Akoma-Ntoso is an example of such a meta-schema: "We can say that Akoma Ntoso is a meta-schema that allows you to build your own schema: it provides the building blocks for different organisations to use to

Levels of Homoiconicity [closed]

不打扰是莪最后的温柔 提交于 2019-12-05 18:34:01
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . This is a follow up to my previous question. I’m not convinced that Lisp code is as Homoiconic as machine code on a Von Neumann architecture. It seems obvious to me that in both cases code is represented as data, but it also seems apparent that you can exploit this property much more freely in machine code than

What exactly does homoiconicity mean?

被刻印的时光 ゝ 提交于 2019-12-03 09:28:50
问题 I was trying to understand the Wikipedia article on homoiconity, but it's too verbose and does not explain the main theory behind the word concisely. I should add that I'm not a native English speaker so I prefer simple English over academic white paper quotes. So, what exactly does it mean if a language is homoiconic? What makes C#, Java or JavaScript non-homoiconic? 回答1: It means "code as data" which is a general characteristic of Lisp family. (add 2 3) Just like above string, which is both

What exactly does homoiconicity mean?

女生的网名这么多〃 提交于 2019-12-03 01:32:06
I was trying to understand the Wikipedia article on homoiconity , but it's too verbose and does not explain the main theory behind the word concisely. I should add that I'm not a native English speaker so I prefer simple English over academic white paper quotes. So, what exactly does it mean if a language is homoiconic? What makes C#, Java or JavaScript non-homoiconic? It means "code as data" which is a general characteristic of Lisp family. (add 2 3) Just like above string, which is both a list and also a function call. The "Homo" prefix stands for this characteristic. Scheme is homo-iconic

In what sense are languages like Elixir and Julia homoiconic?

孤街醉人 提交于 2019-12-02 17:27:47
Homoiconicity in Lisp is easy to see: (+ 1 2) is both the function call to + with 1 , 2 as arguments, as well as being a list containing + , 1 , and 2 . It is simultaneously both code and data. In a language like Julia, though: 1 + 2 I know we can parse this into an Expr in Julia: :(1 + 2) And then we can get the AST and manipulate it: julia> Meta.show_sexpr(:(1+2)) (:call, :+, 1, 2) So, we can manipulate a program's AST in Julia (and Elixir). But are they homoiconic in the same sense as Lisp- is any snippet of code really just a data structure in the language itself? I don't see how code like

Practical example of Lisp's flexibility? [closed]

我是研究僧i 提交于 2019-12-02 13:52:11
Someone is trying to sell Lisp to me, as a super powerful language that can do everything ever, and then some. Is there a practical code example of Lisp's power? (Preferably alongside equivalent logic coded in a regular language.) Mikael Jansson I like macros. Here's code to stuff away attributes for people from LDAP. I just happened to have that code lying around and fiigured it'd be useful for others. Some people are confused over a supposed runtime penalty of macros, so I've added an attempt at clarifying things at the end. In The Beginning, There Was Duplication (defun ldap-users () (let (

Homoiconic and “unrestricted” self modifying code + Is lisp really self modifying?

空扰寡人 提交于 2019-11-27 10:00:30
问题 I will be forward in admiting that my knowledge of Lisp is extremely minimal. However I am extremely interested in the language and plan to begin seriously learning it in the near future. My understanding of these issues is no doubt flawed, so if I say anything which is blatently wrong, please comment and correct me rather than downvoting. Truly Homoiconic and Self-modifiable languages I'm looking for examples of programming languages which support both Homoiconicity (Code has the same