homoiconic | publishing code and words about code on a small scale
kandi X-RAY | homoiconic Summary
kandi X-RAY | homoiconic Summary
Homoiconic was an experiment in publishing code and words about code on a small scale. When I wrote, I added files to the homoiconic git repository, organized by date. Code was included in the posts and also in the folder with the posts that discussed them, so it was easy to download what you liked. You could (and still can) download the entire site as an archive!. Homoiconic was really simple: Snippets of code and words about snippets of code. I avoided words by themselves. And the words existed to amplify and explain the code, rather than the code existing to illustrate the words. This was the opposite of most of the posts we could find on traditional (circa 2004) blogs.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- This method is called when a new method needs to be added to the method .
- Rebuild the method with the given methods .
- This method is called when a method is unbound .
- Returns a new instance of this Proxy
- This method creates a new method for the given method with the given parameters .
- Add new method to the old method .
- Delegates to the user .
homoiconic Key Features
homoiconic Examples and Code Snippets
Community Discussions
Trending Discussions on homoiconic
QUESTION
A claim that I recall being repeated in the Clojure for Lisp Programmers videos is that a great weakness of the earlier Lisps, particularly Common Lisp, is that too much is married to the list structure of Lisps, particularly cons
cells. You can find one occurrence of this claim just at the 25 minute mark in the linked video, but I'm sure that I can remember hearing it elsewhere in the series. Importantly, at that same point in the video, we see this slide, showing us that Clojure has many other data structures than just the old school Lispy lists:
This troubles me. My knowledge of Lisp is quite limited, but I've always been told that a key element of its legendary metaprogrmmability is that everything - yes, everything - is a list and that this is what prevents the sort of errors that we get when trying to metaprogram other languages. Does this suggest that by adding new first-class data structures, Clojure has reduces its homoiconicity, thus making it more difficult to metaprogram than other Lisps, such as Common Lisp?
ANSWER
Answered 2021-Jan-18 at 20:34In Clojure, the only one of those extra data structures that is required for some language constructs, besides lists, are vectors, and those are in well-known places such as around sequences of arguments to a function, or in symbol/expression pairs of a let
. All of them can be used for data literals, but data literals are less often something you want to involve when writing a Clojure macro, as compared to function calls and macro invocations, which are always in lists.
I am not aware of anything in Clojure that makes writing macros more difficult than in Common Lisp, and there are a few features there distinct to Clojure that can make it a little bit easier, such as the behavior where Clojure backquoted expressions by default will namespace-qualify symbols, which is often what you want to prevent 'capturing' a name accidentally.
QUESTION
I'm trying to do what a Lisp hacker would call a "symbol macro". To wit, here's what I'm using now:
...ANSWER
Answered 2020-Dec-03 at 20:13There are two direct ways. If the thing is hygienic and referentially transparent, just use a const
value. That won't work in your example.
Otherwise you have to use the macro in call syntax: @foo()
. There's no around that, it's how Julia syntax work. Although I won't recommend doing it either.
But a nicer alternative, IMHO, would be an "anaphoric context macro", something like:
QUESTION
I'm newbie to mongoDB. Here I face with an error while I want to get the maximum value of the difference of two fields.
Here is the structure of data saved in database:
...ANSWER
Answered 2019-Jan-23 at 16:28QUESTION
I'm newbie to NoSQL databases. What I want is to show the title
, url
and the avg(ratings)
.
The sample data looks like the following:
ANSWER
Answered 2019-Jan-21 at 20:37You have a typo, $Ratings
; use $ratings
as below. Aggregation syntax is case sensitive.
QUESTION
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:
...ANSWER
Answered 2018-Nov-16 at 22:58Do I miss something or stems this behaviour from the fact that haskell is not homoiconic?
No. Homoiconicity is a red herring: every language is homoiconic with its source text and its AST1, and indeed, Haskell is implemented internally as a series of desugaring passes between various intermediate languages.
The real problem is that let...in
and case...of
just have fundamentally different semantics, which is intentional. Pattern-matching with case...of
is strict, in the sense that it forces the evaluation of the scrutinee in order to choose which RHS to evaluate, but pattern bindings in a let...in
form are lazy. In that sense, let p = e1 in e2
is actually most similar to case e1 of ~p -> e2
(note the lazy pattern match using ~
!), which produces a similar, albeit distinct, error message:
QUESTION
Recently, I started to learn cuis-smalltalk, and no I realize how profound and deep OOP with Smalltalk is compared to CLOS (I'm using Ruby). I learned the great idea of that Smalltalk is a reflective system implemented in itself. I found that Ruby has Rubinius, but when I looked for a Common Lisp implementation written in Lisp, I could not find anything similar. There doesn't seem to be a CL distribution written in CL.
In Common Lisp with the CLOS and slime, you can do all the things that can do with the Smalltalk Development environment.
But I have the question if a Common Lisp implementation of itself could be useful for Common Lisp? Or will not add anything special to language because homoiconicity, macros and MOP can handle it all. Are there technical limitations of why it could not be done?
...ANSWER
Answered 2018-Sep-20 at 16:55I think you're conflating Common Lisp and CLOS. CLOS (usually implemented using the MOP but not required) is a facility provided by Common Lisp, but there's no requirement that Common Lisp itself be written in such a way that it actually use CLOS where possible. As Rainer mentioned, the Smalltalk VM isn't purely written in Smalltalk and Common Lisp is (often) already largely written in Common Lisp (there is some low-level support code in assembly/C/whatever and some native libraries utilized to provide the Lisp runtime environment just as there is for the Smalltalk VM. I would suspect that there is more of it for the Smalltalk VM due to the higher-level abstraction that the VM provides and more support/glue code needed to maintain the facade.)
What I think you're actually getting at is if it would be useful if more of Lisp itself were written in CLOS (which at that point would probably not be Common Lisp anymore) since Common Lisp as it is usually implemented does not generally use CLOS (at all?), but rather makes CLOS available as an optional OO framework for your applications. As it is (commonly) implemented, Smalltalk is focused on messages being sent to methods (i.e. making decisions at runtime) and Common Lisp is more focused on macros calling (non-generic) functions (i.e. making many, but not all, decisions at compile-time.) These are fundamental design and implementation decisions but there's no reason you couldn't create a Lisp that had a more Smalltalky 'feel' by utilizing CLOS and deferring more decisions to runtime.
As you've already noted, Lisp already has a very dynamic environment with a similar interactive 'feel' to Smalltalk, so what would this get you? Generally, you'd get the more extreme dynamism that the Smalltalk runtime offers and from a code organization standpoint you would replace a lot of what alist, plist, defparameter, defvar, and to an extent what namespaces are used for with object slots. You would probably also end up with a smaller set of more general functionality (Common Lisp offers a kitchen sink approach to functionality: macros and functions for nearly every use case you can imagine) to support the more extreme capabilities that OO can offer (i.e. transparent proxy objects become trivial to implement, overriding subsystems like the debugger becomes easy etc.) While there are still differences in OO implementations between Smalltalk and Lisp (single vs. multiple-dispatch, single vs. multiple-inheritance, methods vs. generic functions, message sends vs. function calls etc.), I think this could probably get you 95%+ of what Smalltalk offers. What does it cost you? Compile-time clarity and runtime performance... a price Smalltalk pays currently. Probably of greater concern to most Lispers would be that code would look and feel different from what they're used to not unlike how Clojure is different from Common Lisp. So what you'd end up with is a new Lisp with a Smalltalky feel rather than another Common Lisp implementation.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install homoiconic
On a UNIX-like operating system, using your system’s package manager is easiest. However, the packaged Ruby version may not be the newest one. There is also an installer for Windows. Managers help you to switch between multiple Ruby versions on your system. Installers can be used to install a specific or multiple Ruby versions. Please refer ruby-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page