Comments (19)
Is this similar to (get-in lookup [:b :c])
?
from janet.
from janet.
I wonder if there isn't code out there that uses .
for their own purposes...
I'm also not so in to additional shortcuts (including a lot of user-defined macros) because I think it tends to increase the learning burden of the reader (which in turn can lead to additional costs for investigation and maintenance). One of the reasons I like lisp-likes is so I don't have to remember / learn so many exceptions.
I'm probably in the minority though (as someone who's not in to things like (1 @[:a :b :c])
(^^;
from janet.
@im-not-linja I am sorry to make you sad, even as I am not sure what you meant by the accusation. Can you please elaborate? Maybe DM Zulip so as not to pollute the discussion here.
from janet.
FWIW, there was mention from someone on one of the janet-language matrix channels that they are using .
in something they are working on.
from janet.
Closing as I prefer the .
macro. Chained lookup is useful, but there are deeper ramifications for modifying the behavior of in
and get
.
from janet.
from janet.
from janet.
I guess there will be a performance penalty on every lookup with just one key, as the in
function (under the hood, if I am not mistaken) will always need to allocate variadic params tuple.
But I like the idea. What about .
macro, which works as https://github.com/janet-lang/spork/blob/master/spork/misc.janet#L396 but with in
so we can (. lookup :c :d)
?
from janet.
I feel your pain, @sogaiu <3. But dot notation is evoked by this syntax, so even you will be OK.
from janet.
If it ever gets considered, that's it.
from janet.
from janet.
I'm not sure of a good way to express an appropriate search -- the grep example given lacks checking for defmacro
, defmacro-
, and other constructs. Also, people define their own defining constructs which may then be used to define further things...
In any case, if you want to do some spelunking, this list is close to what I know about. Likely there is more stuff out there (^^;
Re: (<int> <array>)
- I think this kind of thing is not that odd if one allows keyword lookup like (:a {:a 1 :b 2})
(I'm not a huge fan of that either, but it's done in at least one other lisp-like IIUC).
from janet.
from janet.
I use plain syntax because the term can be put inside (set)
.
(def lookup @{:a 1 :b @{:c 3}})
(set ((lookup :b) :c) 4)
lookup
# => @{:a 1 :b @{:c 4}}
This macro generates the same plain syntax.
(defmacro .
"Recursive macro (ds key)."
[ds & keyz]
(reduce (fn [t key] (tuple t key)) ds keyz))
from janet.
from janet.
@im-not-linja, I am still in limbo with all the puns I stole. I could indeed be a thief in some situations, but I am usually aware of it. Could you please elaborate?
from janet.
from janet.
I had that feeling, but I wanted to be sure. Just so you know, I will deprecate all the standalone libraries and keep only gp (as the abbreviation of Good Place), so all the names will be free to grab :–).
from janet.
Related Issues (20)
- false branch of `if-let` doesn't report the correct call stack information. HOT 4
- `ev/select` should not resume a dead task. HOT 4
- `try` and `defer` break tail call optimization. HOT 4
- `(= @"update" @"update")` is `false`. HOT 3
- `ev/select` still revives fibers.... HOT 3
- option to unbundle docstrings and potential consequences HOT 8
- splicing into structs/tables HOT 2
- Disasm/asm doesn't round-trip for function with unused argument HOT 1
- eventloop/networking gets stuck on musl HOT 11
- Consider making `module/paths` a dynamic variable HOT 7
- Can it run on iOS? Thank you. HOT 3
- `os/strftime` doesn't respect environment variables. HOT 3
- Re-integrate jpm into janet HOT 49
- recent change kinda breaks lexical scope with multiple modules HOT 2
- How to switch off spork/sh/copy message? HOT 2
- `janet -c source` with missing output files should give informative error message HOT 1
- Linux event loop hanging HOT 7
- Certain PEG patterns don't match HOT 2
- Discrepancy between the website docs and behavior for the `look` peg special HOT 4
- `release-fix` Branch is 5 Commits Behind? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from janet.